<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>adrian.hopebailie.com</title>
	<atom:link href="http://adrian.hopebailie.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://adrian.hopebailie.com</link>
	<description>Online Brain Dump</description>
	<lastBuildDate>Mon, 13 Sep 2010 16:04:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Rethinking Mobile Web Design</title>
		<link>http://adrian.hopebailie.com/2010/09/rethinking-mobile-web-design/</link>
		<comments>http://adrian.hopebailie.com/2010/09/rethinking-mobile-web-design/#comments</comments>
		<pubDate>Mon, 13 Sep 2010 16:04:39 +0000</pubDate>
		<dc:creator>Adrian</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[websites]]></category>

		<guid isPermaLink="false">http://adrian.hopebailie.com/?p=42</guid>
		<description><![CDATA[While at dotMobi I worked with Bryan from Yiibu who designed the DeviceAtlas.com website. Bryan has since become something of a guru on mobile web design and recently released a presentation which I think should be the holy grail for anyone designing a mobile website. Not to mention it should be the considered essential reading [...]]]></description>
			<content:encoded><![CDATA[<p>While at dotMobi I worked with Bryan from <a href="http://yiibu.com">Yiibu</a> who designed the <a href="http://deviceatlas.com">DeviceAtlas.com</a> website.</p>
<p>Bryan has since become something of a guru on mobile web design and recently released a presentation which I think should be the holy grail for anyone designing a mobile website.</p>
<p><span id="more-42"></span>Not to mention it should be the considered essential reading for framework and CMS developers that want to offer mobile.</p>
<p>While a lot of cross-browser and platform design considerations can be handled in the CSS some require (and are better served) by server side tweaks.</p>
<div style="width:425px" id="__ss_5172436"><strong style="display:block;margin:12px 0 4px"><a href="http://www.slideshare.net/bryanrieger/rethinking-the-mobile-web-by-yiibu" title="Rethinking the Mobile Web by Yiibu">Rethinking the Mobile Web by Yiibu</a></strong><object id="__sse5172436" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=yiibu-rethinkingthemobileweb-100910074556-phpapp01&#038;stripped_title=rethinking-the-mobile-web-by-yiibu" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed name="__sse5172436" src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=yiibu-rethinkingthemobileweb-100910074556-phpapp01&#038;stripped_title=rethinking-the-mobile-web-by-yiibu" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="padding:5px 0 12px">View more <a href="http://www.slideshare.net/">presentations</a> from <a href="http://www.slideshare.net/bryanrieger">Bryan Rieger</a>.</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://adrian.hopebailie.com/2010/09/rethinking-mobile-web-design/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unprotected privates?</title>
		<link>http://adrian.hopebailie.com/2010/07/unprotected-privates/</link>
		<comments>http://adrian.hopebailie.com/2010/07/unprotected-privates/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 21:34:03 +0000</pubDate>
		<dc:creator>Adrian</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[immutablity]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://adrian.hopebailie.com/?p=31</guid>
		<description><![CDATA[With some inline class over-rides and some reflection it is possible to dynamically change the immutability of a class.]]></description>
			<content:encoded><![CDATA[<p>I was doing some work on an SDK recently which required that I access a protected member of a class. I didn&#8217;t want to have to override the class just to get access to it so I did some digging and discovered some interesting things you can do with Java and the JVM to access not only protected but also private class members.</p>
<p>It made me think a little about how we design classes and assumptions we make about immutability and access to internals. Here I have provided 2 examples of immutable classes. The first is obviosuly not properly immutable simply due to the fact that it&#8217;s field is declared protected and not private.</p>
<p><span id="more-31"></span></p>
<blockquote><p>If you need to know what immutability is have a look at <a href="http://en.wikipedia.org/wiki/Immutable_object" target="_blank">Wikipedia</a></p></blockquote>
<p>The goal of the exercise is to execute the following code:</p>
<pre class="brush: java; title: ; notranslate">
Immutable myImmutable =
	new Immutable(new String[]{&quot;Hello&quot;, &quot;World&quot;});

//Do some cunning stuff here...

System.out.println(myImmutable );
myImmutable.getValue()[0] = &quot;Goodbye&quot;;
System.out.println(myImmutable );
</pre>
<p>Now both classes are designed to be immutable so that this code should always print:</p>
<pre>Hello World
Hello World</pre>
<p>But if we put in the right cunning stuff we could get:</p>
<pre>Hello World
Goodbye World</pre>
<h3>Accessing Protected Fields</h3>
<p>The &#8220;not-so-immutable&#8221; class looks like this:</p>
<pre class="brush: java; title: ; notranslate">
public class Immutable
{
	protected String[] value;

	public Immutable(String[] value)
	{
		this.value = value;
	}

	public String[] getValue()
	{
		//To maintain immutability we copy the array
		String[] return_value = new String[value.length];
		System.arraycopy(
			value, 0,
			return_value, 0,
			value.length);
		return return_value;
	}

	@Override
	public String toString()
	{
		StringBuffer buffer = new StringBuffer();
		for(int i = 0; i &lt; value.length; i++)
		{
			buffer.append(value[i] + &quot; &quot;);
		}
		return buffer.toString();
	}

}
</pre>
<p>A pretty easy to understand class, but wait till you see how easily we can circumvent the immutability.</p>
<pre class="brush: java; title: ; notranslate">
Immutable myImmutable =
	new Immutable(new String[]{&quot;Hello&quot;, &quot;World&quot;}){
	@Override
	public String[] getValue()
	{
		return value;
	}
};

System.out.println(myImmutable );
myImmutable.getValue()[0] = &quot;Goodbye&quot;;
System.out.println(myImmutable );
</pre>
<h3>Accessing Private Fields</h3>
<p>Now you might say that the class is not really immutable because you expose the fields to sub-classes. But what if we define exactly the same class but make the field <em>value</em> private.</p>
<p>It&#8217;s still possible to expose the field albeit a little more complicated.</p>
<pre class="brush: java; title: ; notranslate">
Immutable myImmutable =
	new Immutable(new String[]{&quot;Hello&quot;, &quot;World&quot;}){
	@Override
	public String[] getValue()
	{
		try
		{
			Class clazz = Immutable.class;
			Field private_field =
				clazz.getDeclaredField(&quot;value&quot;);
			private_field.setAccessible(true);
			return ((String[]) private_field.get(this));
		}
		catch (Exception e)
		{
			e.printStackTrace();
			return null;
		}
	}
};

System.out.println(myImmutable );
myImmutable.getValue()[0] = &quot;Goodbye&quot;;
System.out.println(myImmutable );
</pre>
<p>Easy as that.</p>
]]></content:encoded>
			<wfw:commentRss>http://adrian.hopebailie.com/2010/07/unprotected-privates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Back in the swing of things</title>
		<link>http://adrian.hopebailie.com/2010/05/back-in-the-swing-of-things/</link>
		<comments>http://adrian.hopebailie.com/2010/05/back-in-the-swing-of-things/#comments</comments>
		<pubDate>Fri, 21 May 2010 13:05:48 +0000</pubDate>
		<dc:creator>Adrian</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Sport]]></category>
		<category><![CDATA[Tech]]></category>
		<category><![CDATA[google apps]]></category>
		<category><![CDATA[short url]]></category>
		<category><![CDATA[websites]]></category>

		<guid isPermaLink="false">http://adrian.hopebailie.com/?p=27</guid>
		<description><![CDATA[Over inflated website prices, cost to company of bad IT and some new projects in the pipeline.]]></description>
			<content:encoded><![CDATA[<p>So after some major overhauls I have started using this blog and some other web projects as a way to stay in touch with the web development space.</p>
<p>My commercial development work at <a title="My employer" href="http://www.s1.com" target="_blank">S1</a> is all Java based and seldom has anything to do with web technology let alone a GUI.</p>
<p>So in my spare time I plan to keep this blog updated and try to hone my WordPress skills. I have started a small consulting business on the side to help small/medium companies with general IT stuff. Mostly this has been free advice to friends and relatives but lately I have started trying to provide some basic web and email services to companies that can&#8217;t afford the rip-off prices of digital agencies.</p>
<p><span id="more-27"></span>I am often amazed at:</p>
<ol>
<li>How many companies put up with terrible IT operations when they are dragging the whole company down.Paying for decent IT services shouldn&#8217;t be considered a grudge purchase. Gone are  the days of jack-of-all-trades System Administrators that install, configure and administer all the IT systems in a small company. Between email, accounts, CRM, sales and all the other departments that are almost completely digital these days the complexity has just grown too much for one person to know enough to run everything.
<p>If it&#8217;s not part of your core business, outsource it. Don&#8217;t force your employees to endure terrible services that prevent them from effectively doing their work. I often wonder how many CFO&#8217;s consider the cost of their employees losing email for half a day vs the little bit they saved by trying to run their own mail server.</p>
<p>That said, make sure you get what you pay for and only pay for what you need, which brings me to my second observation.</li>
<li>How IT services companies are still praying on the naivete of their customers.How many small companies outsource their email and website setup to someone that persuades them they need a collaboration server like Sharepoint or a complicated mail server like Exchange. Take nothing away from those products but they are not targeted at little 10 person companies.
<p>My biggest bug-bear are digital agencies that try to persuade their clients they need to pay more than  R50k for a simple website when they could easily design a good theme for WordPress/Joomla/Drupal and be done with it.</p>
<p>Some times the custom functionality that customers want warrants the huge price tag, and I think there the agencies are spot on but I&#8217;d venture that 90% of small/medium size  companies don&#8217;t need anything that those platforms don&#8217;t already offer.</li>
</ol>
<p>So that, and my web tech withdrawal has inspired me to get back on the blog and start some little projects.</p>
<p>I have already lined up my first customer for website setup and hosting and I&#8217;m hoping to get some more soon, if you know anyone with a small company that needs a website let me know.</p>
<p>I have used Google Apps on the hopebailie.com domain for some time and I must say, I love it. So much so that I went and got myself setup as a reseller so if you want email with your website, voila. What I love about Google Apps is that everything is online. All you need as a small business is an internet connection. With the Premier Addition of Apps you can even use Outlook to connect to a faux-Exchange server and sync mail, calendar contacts and all. I&#8217;m a fan, can you tell?</p>
<p>Another little project I have started up is a URL shortening service like bit.ly and tinyurl.com. I discovered 2 really nice domains for this (http://sp.or.tz and http://sh.or.tz) which I registered and I am in the process of developing the application for them.</p>
<p>I&#8217;d like to add some features that aren&#8217;t available with the other services like crawling the destination URL to get some tags and detect if there is a mobile friendly version to redirect visitors to when they are on a mobile phone. (I have Blackberry and hate following Twitter links because they always load huge page that is terrible to read.)</p>
<p>I also want sp.or.tz to be sports focused and have some sports specific features like fetching results/fixtures from guessable URLs.</p>
<p>If you have any ideas or suggestion for the services pop them in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://adrian.hopebailie.com/2010/05/back-in-the-swing-of-things/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Crime in SA &#8211; what now?</title>
		<link>http://adrian.hopebailie.com/2007/07/crime-in-sa-what-now/</link>
		<comments>http://adrian.hopebailie.com/2007/07/crime-in-sa-what-now/#comments</comments>
		<pubDate>Fri, 27 Jul 2007 12:50:17 +0000</pubDate>
		<dc:creator>Adrian</dc:creator>
				<category><![CDATA[Ramblings]]></category>
		<category><![CDATA[crime]]></category>
		<category><![CDATA[south africa]]></category>

		<guid isPermaLink="false">http://adrian.hopebailie.com/2007/07/27/crime-in-sa-what-now/</guid>
		<description><![CDATA[I was recently browsing around Facebook and came across an event being organised in London where a bunch of SAffas are getting to gather to protest against the crime in SA. The event has drawn a number of interesting responses, not least from a local blogger who runs the blog SA Rocks. Nic&#8217;s post entitled [...]]]></description>
			<content:encoded><![CDATA[<p>I was recently browsing around Facebook and came across an <a href="http://www.facebook.com/event.php?eid=2430703203&amp;ref=nf" title="ACT4SA" target="_blank">event </a>being organised in London where a bunch of SAffas are getting to gather to protest against the crime in SA. The event has drawn a number of interesting responses, not least from a local blogger who runs the blog <a href="http://www.sarocks.co.za" title="SARocks" target="_blank">SA Rocks</a>.</p>
<p>Nic&#8217;s post entitled &#8220;<a href="http://sarocks.co.za/2007/07/26/protest-against-crime-in-sa-to-be-held-in-london/" title="Protest against crime in SA to be held in LONDON??" target="_blank">Protest against crime in SA to be held in LONDON??</a>&#8221; was a stab at these expats getting all fired up about the state of crime in a country they have seemingly turned their backs on. Nic argues that the best way to improve the situation in SA is to be here helping first-hand. The post has drawn quite a long commentary with veritable essays by some visitors, including yours truly.</p>
<p><span id="more-10"></span>The post did get me thinking however about crime in SA and how things have unfolded in the past few years. With my involvement in SARugby.com I often come across disgruntled South Africans who have a lot to complain about, and more often than not those complaints revolve around crime, transformation and in the case of rugby, quotas.</p>
<p>What often saddens me is that we seem, even after our 12 years of freedom, unable to argue an issue without racial stereotypes rising their ugly heads. Both black and white visitors to SARugby.com are responsible. A post made by a visitor will inflame someone else who will immediately say something like &#8220;you guys&#8221;, grouping all other visitors of the same, colour, creed or opinion in his rebuttal.</p>
<p>A case in point was an excellent article by our regular columnist John Gardener, entitled &#8220;<a href="http://www.sarugby.com/news/News/article/sid=6333.html" title="What kind of Support?" target="_blank">What kind of Support?</a>&#8220;, in which John lashed out at the disgusting behaviour of some drunk South African rugby supporters in Hong Kong who hurled racial abuse at SA 7&#8242;s coach Paul Treu after his lads lost a game.</p>
<p>John&#8217;s opinion was that these kind of people were the supporters that South African rugby didn&#8217;t need. The mistake he made was labeling them &#8220;<span class="newsstory"><span lang="en-US">beer-swilling, biltong-biting, boerewors-braaing believers in the nostalgia that South African sport should still be as white as it used to be&#8221;. WOW, did that cause a stink.</span></span></p>
<p>I don&#8217;t know if it was the reference to the biltong or the boerewors that got everyone so fired up but all of a sudden John was accused of calling all Afrikaans rugby supporters racists. Essentially because the Afrikaans community form the majority of rugby supporters, biltong eaters or whatever they felt any criticism of that kind of support was a direct criticism of Afrikaans people. I mean, come on.</p>
<p>I have noticed a similar trend when it comes to the crime debate. If you start ranting about the crime in SA everyone tells you to pipe down and stop being so Anti-South African. &#8220;If it&#8217;s so much better in Canada [Australia, England], why don&#8217;t you just move there.&#8221; they will say. Well, its easy really, because I don&#8217;t want to. Does that mean that the compromise of living in the greatest country in the world is living in fear. Does it mean that we shouldn&#8217;t be trying to do something about this situation?</p>
<p>There&#8217;s this ridiculous idea that the only people complaining about the crime are the whites. What?! If whites were the only ones being affected, every single white person would have been either murdered or raped by now. The stats are that bad!</p>
<p>In my opinion its our duty as people living in a democratic country to raise our concerns with the government we have elected to run our beautiful country. If they are not doing their jobs they should face the wrath of the people. So what do we do, complain to the Minister of Safety and Security? Not likely, last year that self-same minister, Charles Nqakula, said in his budget speech in parliament:</p>
<blockquote><p>&#8220;The whingers [complainers] can do one of two things. They can continue to whinge until they are blue in the face &#8212; they can be as negative as they want to &#8212; or they can simply leave this country,&#8221;</p></blockquote>
<p>So what are our options, I for one intend to support the guys organising that march. If they run a similar one here in SA I&#8217;ll be there. Otherwise, what else can be done. I&#8217;m not a vigilante what&#8217;s my next option? Any ideas?</p>
<p>Check out the ACTSA site at: <a href="http://www.act4sa.org" title="ACT4SA" target="_blank">http://www.act4sa.org</a></p>
]]></content:encoded>
			<wfw:commentRss>http://adrian.hopebailie.com/2007/07/crime-in-sa-what-now/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Installing extensions on shared hosts</title>
		<link>http://adrian.hopebailie.com/2007/07/php5-extensions-shared-server/</link>
		<comments>http://adrian.hopebailie.com/2007/07/php5-extensions-shared-server/#comments</comments>
		<pubDate>Thu, 26 Jul 2007 20:50:29 +0000</pubDate>
		<dc:creator>Adrian</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://adrian.hopebailie.com/2007/07/26/php5-extensions-shared-server/</guid>
		<description><![CDATA[I have a hosting account with Site5. I must say there service, though sometimes delayed by the difference in time zones, is generally excellent and they have a large community of users in their forums who will often help you out too. Recently I had a need to not only use php5 but to also [...]]]></description>
			<content:encoded><![CDATA[<p>I have a hosting account with <a href="http://www.site5.com/" title="Site5" target="_blank">Site5</a>. I must say there service, though sometimes delayed by the difference in time zones, is generally excellent and they have a large community of users in their forums who will often help you out too.</p>
<p>Recently I had a need to not only use php5 but to also install the bz2 php extension on my account. This proved to be an interesting adventure and since I found very little help on the forums and the need was beyond the scope of the support I bumbled along on my own. I used various resources and finally got it right. Here&#8217;s how:</p>
<p><strong>P.S. You&#8217;ll need Command-line access to your server (eg: via SSH).</strong></p>
<p><span id="more-9"></span></p>
<h2>1. Using php5 on Site5</h2>
<p>Site5 has both php4 and php5 installed. By default your scripts are executed using php4 however there are a number of ways to force the server to interpret the scripts using php5. The easiest of thses is to use a .htaccess file in the root folder of your app/site. By adding the following lines to the file I forced all .php files to be interpreted by Apache using php5.</p>
<p><code>AddHandler application/x-httpd-php5 .php</code></p>
<p>The problem is that even though this will work for Apache it doesn&#8217;t help us when we are executing php on the command-line. But we&#8217;ll sort this out a little bit further down the road.</p>
<h2>2. Getting the extension</h2>
<p>Usually if you have command line access you can simply run:</p>
<p><code>pecl install bz2</code></p>
<p>This will download the extension, compile it for the local machine and install it. The problem is that when you are accessing a shared server you seldom have sufficient privileges for the process to complete and as such it fails miserably.</p>
<p>So, we are forced to download the extension manually. As mentioned already, most of our hassles are due to permissions. As such I find it easiest to just re-create the necessary basic linux folder structure in our own home folder where we have permission to do as we wish!</p>
<p>I have created the following folders:</p>
<p><code>mkdir ~/bin<br />
mkdir ~/bin/php5<br />
mkdir ~/bin/php5/extensions<br />
mkdir ~/tmp<br />
mkdir ~/etc</code></p>
<p>The ~ is a short-cut to your home directory. So the true path to <em>~/bin</em> is usually (well it is on my Site5 server) <em>/home/username/bin.</em> So now all we have to do is download the extension to<em> ~/etc.</em></p>
<p>All php extensions can be downloaded from <a href="http://pecl.php.net" title="PECL" target="_blank">pecl.php.net</a>. I&#8217;d recommend that if you are having issues with dependencies you check the site and ensure your installed extension does not have a dependency that is not installed. The exact url for your extension will be <em>http://pecl.php.net/get/extension_name</em> so for our bz2 extension we execute the following on the command line:</p>
<p><code>cd ~/etc<br />
wget http://pecl.php.net/get/bz2</code></p>
<p>You should now have a file in your ~/etc directory called <em>bz</em>. So it&#8217;s time to unpack it. The files come tarred and zipped so we use the following command to restore them to their full glory:</p>
<p><code>tar -xzf bz2</code></p>
<p>Check the directory again. You&#8217;ll notice there is now a folder with the name of the extension and the version. In my case it&#8217;s <em>bz2-1.0</em>. Now things start to get a bit spicy.</p>
<h2>3. Setting php5 as your default command-line executable</h2>
<p>For  users who only have one version of php on their server this step is unnecessary but for those of us on site5 who want to use php5 we have to get clever.</p>
<p>The first thing we have to do is find out where our php5 executables are located. The easiest way to do this is to execute the built in <em>phpinfo()</em> command. Create a quick php file in your webroot and add this line:</p>
<p><code></code></p>
<p>Visit the page in your browser and you should get a page that tells you all about your current php installation. The first thing to do is check that your page is being executed by the version of php you want. This is displayed at the top of the page. Next browse down  a few lines for a line that says <strong>Configure Command</strong>. These are the parameters that were used to compile your php executable. One of the parameters will be <strong>&#8211;exec-prefix</strong> parameter which is the path of the executables. The tricky this is that we are actually looking for the <strong>bin</strong> directory at this path.</p>
<p>In my situation the <strong>&#8211;exec-prefix</strong> parameter is <strong>/usr/local/php5</strong>. So what i&#8217;ve done is changed my working directory to this one, and listed the contents of the folder:</p>
<p><code>cd /usr/local/php/bin<br />
ls -l</code></p>
<p>There are 3 executables in here that I need: <strong>php5</strong>, <strong>php-config5</strong> and <strong>phpize5</strong>. At the moment if I try to run php from the command line it uses php4. You can check which version you are using by executing:</p>
<p><code>php -v</code></p>
<p>I actually want to execute <strong>/usr/local/php5/bin/php5</strong>. So what I&#8217;m gonna do is create links in <strong>~/bin</strong> to the executables I need. So lets move to that directory and create the 3 symbolic links we need.</p>
<p><code>cd ~/bin<br />
ln -s /usr/local/php5/bin/php5 php<br />
ln -s /usr/local/php5/bin/php-config5 php-config<br />
ln -s /usr/local/php5/bin/phpize5 phpize</code></p>
<p>So now if we execute:</p>
<p><code>./php -v</code></p>
<p>We see that we are executing our php5 executable. But this will only work from within this directory. So we need to change the default path linux uses to find these executables. We want to edit the $PATH environment variable. In most instances we can do this by editing our ~/.bash_profile file so we run:</p>
<p><code>pico ~/.bash_profile</code></p>
<p>You need to find a line that starts with <strong>PATH=</strong>. At Site5 my default settings look like this:</p>
<p><code>PATH=$PATH:$HOME/bin</code></p>
<p>What this means is the system sets my PATH environment variable equal to the default system PATH and then appends ~/bin onto the end (~ is the same as $HOME). Unfortunately this means that when it looks for the <strong>php</strong> executable it looks in the default system bin folder and finds the php4 executable first before it finds our newly created link to our php5 executable. So we change the line to:</p>
<p><code>PATH=$HOME/bin:$PATH</code></p>
<p>Save the file. To effect the change you&#8217;ll need to reload your session. I just logged out and back in to be sure. Then just to be sure the change has taken effect I type:</p>
<p><code>echo $PATH</code></p>
<p>You should see something like:</p>
<p><code>/home/username/bin:/usr/local/bin:/bin:/usr/bin</code></p>
<p>So now when you check the version of your default php executable you should see that it is now using php5.</p>
<p><code>php -v</code></p>
<p>Yippee! Time to compile our extension.</p>
<h2>4. Compiling the extension</h2>
<p>Now that we know we&#8217;re using all the right executables on the command line we can prepare our extension. Go to the directory where our extension was unpacked:</p>
<p><code>cd ~/etc/bz2-1.0</code></p>
<p>Use the phpize function to get us ready for configuration.</p>
<p><code>phpize</code></p>
<p>The function will output a few lines from which you can determine which API version your extension will be compiled for.  So we are ready to run the configure command which will produce the Makefiles so we can compile our extension. If there are any configuration directives you want to include this is where you will do it. For our sakes we just want to ensure that from here on in the process uses the correct folders. So we execute:</p>
<p><code>./configure</code></p>
<p>Almost there. Unfortunately our Makefile isn&#8217;t 100% ready.</p>
<p><code>pico Makefile</code></p>
<p>Look for the line that starts with:</p>
<p><code>EXTENSION_DIR = /</code></p>
<p>Delete the path that is there and replace it with:</p>
<p><code>EXTENSION_DIR = /home/username/bin/php5/extensions</code></p>
<p>Let&#8217;s go:</p>
<p><code>make<br />
make install</code></p>
<p>Would you believe it. We&#8217;re almost done. The extension is now there but we need to edit our php configuration file to use the extension. On most shared hosts you cant edit the default <strong>php.ini</strong> but you can usually create your own. On the Site5 servers we simply include our own <strong>php.ini</strong> at the web root.  So first I changed to that directory:</p>
<p><code>cd ~/public_html</code></p>
<p>Now we need a copy of the default <strong>php.ini</strong>. If you go back to the test page we created earlier that displays your php configuration you&#8217;ll find the path to the <strong>php.ini</strong> being used. On Site5 my php configuration file is at: <em>/usr/local/Zend/etc/php.ini</em>. So I execute:</p>
<p><code>cp /usr/local/Zend/etc/php.ini .</code></p>
<p>Now I&#8217;ve got an exact copy of the default php.ini so I can edit this.</p>
<p><code>pico php.ini</code></p>
<p>Find the line that starts:</p>
<p><code>extension_dir = "./"</code></p>
<p>Replace it with:</p>
<p><code>extension_dir = "/home/username/bin/php/extensions"</code></p>
<p>Then you need to include the following line so that the system loads your new extension:</p>
<p><code>extension=bz2.so</code></p>
<p>And thats it! All done. Reload your phpinfo() pageand somewhere down there you should see that your extension has now been loaded.</p>
]]></content:encoded>
			<wfw:commentRss>http://adrian.hopebailie.com/2007/07/php5-extensions-shared-server/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

