<?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>The Netocracy &#187; php5.3</title>
	<atom:link href="http://www.thenetocracy.com/tags/php53/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thenetocracy.com</link>
	<description>Liberty Prime is go</description>
	<lastBuildDate>Mon, 21 Dec 2009 07:01:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Installing PHP5.3 beta on Ubuntu 8.10</title>
		<link>http://www.thenetocracy.com/2009/03/06/installing-php53-beta-on-ubuntu-810/</link>
		<comments>http://www.thenetocracy.com/2009/03/06/installing-php53-beta-on-ubuntu-810/#comments</comments>
		<pubDate>Fri, 06 Mar 2009 12:38:55 +0000</pubDate>
		<dc:creator>Jake</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[compile]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php5.3]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.thenetocracy.com/?p=69</guid>
		<description><![CDATA[I wanted to try out the new feature available in PHP 5.3 a while ago. And ran into a few obstacles trying get it installed. Since then I&#8217;ve installed it a few times successfully. In each case I already has &#8230; <a href="http://www.thenetocracy.com/2009/03/06/installing-php53-beta-on-ubuntu-810/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I wanted to try out the new feature available in PHP 5.3 a while ago. And ran into a few obstacles trying get it installed. Since then I&#8217;ve installed it a few times successfully.</p>
<p>In each case I already has apache, php and mysql installed according to the instructions in the <a href="https://help.ubuntu.com/community/ApacheMySQLPHP">Ubuntu Documentation</a>.</p>
<p>Download the latest release candidate or snapshot of PHP 5.3. Extract the source.</p>
<p>The first issue I had was with apxs2, to get PHP installed for Apache. I didn&#8217;t have the expected apxs2 file. To resolve this I installed apache2-threaded-dev<br />
<code>sudo apt-get install apache2-threaded-dev</code></p>
<p>Then I was ready to run (with any addition options you need/want)<br />
<code>./configure --with-apxs2=usr/bin/apxs2 --with-mysql</code></p>
<p>I got the error &#8220;xml2-config not found. Please check your libxml2 installation.&#8221;<br />
I needed to install libxml2-dev<br />
<code>sudo apt-get install libxml2-dev</code></p>
<p>Running the configure command again, it succeeded.</p>
<p>Next to run the make file <code>sudo make</code><br />
Followed by <code>sudo make install</code><br />
However it alerts you that you need to have at least one LoadModule in your httpd.conf. Ubuntu doesn&#8217;t use httpd.conf to load modules so unless you have added something already, then your httpd.conf will be blank. All you need to do is add a LoadModule line. It doesn&#8217;t matter if the module exists or not. I simply added LoadModule whatever.</p>
<p>Now the install should work. Finally you might need to enable the php5 module, and restart apache.<br />
<code>a2enmod php5<br />
apache2ctl restart</code><br />
Checking phpinfo(), you should now be running PHP 5.3</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thenetocracy.com/2009/03/06/installing-php53-beta-on-ubuntu-810/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apple Releases Security Update 2008-007 and Breaks my Apache</title>
		<link>http://www.thenetocracy.com/2008/10/11/apple-releases-security-update-2008-007-breaks-my-apache/</link>
		<comments>http://www.thenetocracy.com/2008/10/11/apple-releases-security-update-2008-007-breaks-my-apache/#comments</comments>
		<pubDate>Fri, 10 Oct 2008 13:23:16 +0000</pubDate>
		<dc:creator>Jesse</dc:creator>
				<category><![CDATA[Everything Everything]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php5.3]]></category>

		<guid isPermaLink="false">http://www.thenetocracy.com/?p=45</guid>
		<description><![CDATA[As soon as I installed the Apple Security Update 2008-007 this afternoon, restarted and re-opened firefox to all my previous tabs I knew something was up  when my localhost suddenly wasn&#8217;t responding. According to Apple, this fix updates to a &#8230; <a href="http://www.thenetocracy.com/2008/10/11/apple-releases-security-update-2008-007-breaks-my-apache/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>As soon as I installed the <a title="Apple" href="http://support.apple.com/kb/HT3216">Apple Security Update 2008-007</a> this afternoon, restarted and re-opened firefox to all my previous tabs I knew something was up  when my localhost suddenly wasn&#8217;t responding.</p>
<p>According to Apple, this fix updates to a new version of Apache 2:</p>
<blockquote><p>Apache is updated to version 2.2.9 to address several vulnerabilities, the most serious of which may lead to cross site request forgery.</p></blockquote>
<p>In order to get Apache Running, the first thing I tried was openening System Preferences and enabling/disabling web sharing a couple of times  &#8211; <i>which did nothing.</i></p>
<p>Second thing was trying to run <strong>httpd</strong> from the command line. Again, no success but it gave me some useful errors. For some reason it was attempting to load some old set of config files that I hadn&#8217;t used for ages &#8211; so I promptly removed those and solved those &#8216;syntax errors&#8217; (cleanups are good!)</p>
<p>Once my config files were in order, I was back to square one with this error&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">httpd: Syntax error on line <span style="color: #000000;">116</span> of <span style="color: #000000; font-weight: bold;">/</span>private<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>httpd.conf: Cannot load <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>libexec<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>libphp5.so into server: dlopen<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>libexec<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>libphp5.so, <span style="color: #000000;">10</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>: no suitable image found.  
Did <span style="color: #c20cb9; font-weight: bold;">find</span>:\n\t<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>libexec<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>libphp5.so: mach-o, but wrong architecture</pre></div></div>

<p>All this meant was that the compiled version of PHP5.3 I had (<a href="http://www.thenetocracy.com/2008/10/06/installing-php-53-on-mac-os-x-leopard/">see my other post on running php 5.3</a>) was compiled at 32bit, and Apple had set Apache back to 64Bit. Two commands solved this problem&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>httpd <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>httpd-fat
<span style="color: #c20cb9; font-weight: bold;">sudo</span> lipo <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>httpd <span style="color: #660033;">-thin</span> i386 <span style="color: #660033;">-output</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>httpd</pre></div></div>

<p>Note that the first command simply backs up httpd.</p>
<p>Since I&#8217;ve got web-sharing enabled, I assume that there&#8217;s some system that keeps track of the httpd processes, &#8211; as soon as killed the running 64bit httpd processes in Activity Monitor, it all seemed to be working again.</p>
<p>Just one note here: I did re-compile PHP again with the command line I posted earlier. There were no errors, and no differences so I don&#8217;t think that it was necessary, but I did try it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thenetocracy.com/2008/10/11/apple-releases-security-update-2008-007-breaks-my-apache/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Late Static Binding with PHP 5.3</title>
		<link>http://www.thenetocracy.com/2008/10/06/late-static-binding-with-php-53/</link>
		<comments>http://www.thenetocracy.com/2008/10/06/late-static-binding-with-php-53/#comments</comments>
		<pubDate>Mon, 06 Oct 2008 05:34:45 +0000</pubDate>
		<dc:creator>Jesse</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[late static binding]]></category>
		<category><![CDATA[php5.3]]></category>

		<guid isPermaLink="false">http://www.thenetocracy.com/?p=28</guid>
		<description><![CDATA[With the Alpha3 Release of PHP 5.3 out and about it’s looking like the much anticipated late static binding functionality is starting to solidify. Once I finally got PHP 5.3 running (see my previous post) I worked through creating an  &#8230; <a href="http://www.thenetocracy.com/2008/10/06/late-static-binding-with-php-53/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>With the Alpha3 Release of PHP 5.3 out and about it’s looking like the much anticipated <a title="Late Static Binding on the PHP Manual" href="http://www.php.net/manual/en/language.oop5.late-static-bindings.php">late static binding</a> functionality is starting to solidify. Once I finally got PHP 5.3 running (see my previous post) I worked through creating an  ActiveRecord-like class to see if I could make a PHP object do act in a similar way  similar to Ruby&#8217;s Active Record.</p>
<p>Lets see where I ended up&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> ActiveRecord <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000000; font-weight: bold;">function</span> find<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$called_class</span> <span style="color: #339933;">=</span> get_called_class<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//a new function as of a2</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000088;">$called_class</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #666666; font-style: italic;">//A derived example to show the late static binding in action</span>
  <span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000000; font-weight: bold;">function</span> testLSB<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">return</span> static<span style="color: #339933;">::</span><span style="color: #000088;">$table</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">class</span> BasicModel <span style="color: #000000; font-weight: bold;">extends</span> ActiveRecord <span style="color: #009900;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000088;">$table</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'basicModel'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #666666; font-style: italic;">//Output examples</span>
<span style="color: #b1b100;">echo</span> <span style="color: #990000;">get_class</span><span style="color: #009900;">&#40;</span>BasicModel<span style="color: #339933;">::</span><span style="color: #004000;">Find</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//Output - BasicModel</span>
<span style="color: #b1b100;">echo</span> BasicModel<span style="color: #339933;">::</span><span style="color: #004000;">testLSB</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>          <span style="color: #666666; font-style: italic;">//Output - basicModel</span>
<span style="color: #b1b100;">echo</span> BasicModel<span style="color: #339933;">::</span><span style="color: #000088;">$table</span><span style="color: #339933;">;</span>             <span style="color: #666666; font-style: italic;">//Output - basicModel</span></pre></div></div>

<h6>First place I saw the get_called_class() method was on the <a href="http://www.php.net/manual/en/language.oop5.late-static-bindings.php#85725">PHP Late Static Binding Manual Page</a></h6>
<p>The above example is celarly a bit derived, but I&#8217;m quite excited at where this is heading. I still have a bit of work to do if I want to end up accessing all my models in the Rails/Active Record fashion.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$user</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> User<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//by passing a user id directly to the constructor</span>
<span style="color: #000088;">$user</span> <span style="color: #339933;">=</span> User<span style="color: #339933;">::</span><span style="color: #004000;">Find</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//by static::find();</span>
<span style="color: #000088;">$users</span> <span style="color: #339933;">=</span> Users<span style="color: #339933;">::</span><span style="color: #004000;">FindAll</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//by static::findAL() returning an array of User objects.</span></pre></div></div>

<p>I don&#8217;t see these requirements too difficult to achieve but it will require some trickery. The problem will lie if I decide to put all the database logic into static::Find(). If static::Find() returns a new instance of the class, and the constructor of each class blindly returns the results of a static::Find() call, it won&#8217;t work. The code below  doesn&#8217;t work because a constructor can&#8217;t return a new object instance and $this can&#8217;t be reassigned (like you can in some languages).</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
 <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>data <span style="color: #339933;">=</span> <span style="color: #000088;">$id</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span><span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$this</span> <span style="color: #339933;">=</span> static<span style="color: #339933;">::</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//fatal error, can't reassign $this</span>
    <span style="color: #b1b100;">return</span> static<span style="color: #339933;">::</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//also won't do anything useful</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>From fist impressions I think the idea of using is_array() to check if the $id parameter is a good way for static::Find() to pass an array to the constructor without ending up in a loop. This suggests that there needs to be a similar check inside static::Find() to return only an array in some cases instead of a new object.</p>
<p>So I&#8217;ve come up with this idea to solve the above issue.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
 <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>data <span style="color: #339933;">=</span> <span style="color: #000088;">$id</span><span style="color: #339933;">;</span>
 <span style="color: #b1b100;">else</span>
    <span style="color: #000088;">$this</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>data <span style="color: #339933;">=</span> static<span style="color: #339933;">::</span><span style="color: #004000;">find</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//static::find() returns an array;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">public</span> static <span style="color: #000000; font-weight: bold;">function</span> Find<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #339933;">,</span><span style="color: #000088;">$returnArray</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$foundResults</span> <span style="color: #339933;">=</span> insert_SQL_function_here<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$returnArray</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$foundResults</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//return basic array</span>
  <span style="color: #b1b100;">else</span><span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$called_class</span> <span style="color: #339933;">=</span> get_called_class<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000088;">$called_class</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$foundResults</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>I&#8217;m not 100% convinced this is the best way to solve this. Ideally I&#8217;d like a solution that didn&#8217;t require the checks in __construct() and static::find(), but this is a start, and it&#8217;s a a reasonable exercise in using LSB.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thenetocracy.com/2008/10/06/late-static-binding-with-php-53/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing PHP 5.3 on Mac OS X Leopard</title>
		<link>http://www.thenetocracy.com/2008/10/06/installing-php-53-on-mac-os-x-leopard/</link>
		<comments>http://www.thenetocracy.com/2008/10/06/installing-php-53-on-mac-os-x-leopard/#comments</comments>
		<pubDate>Mon, 06 Oct 2008 03:20:24 +0000</pubDate>
		<dc:creator>Jesse</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[compile]]></category>
		<category><![CDATA[leopard]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[opensource]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php5.3]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://www.thenetocracy.com/?p=5</guid>
		<description><![CDATA[After many frustrating hours and three separate attempts I am finally running PHP 5.3.0alpha3 on my MacBook Pro using the default Leopard Apache installation (the one you can turn on/off with web sharing). This post is as much a summary &#8230; <a href="http://www.thenetocracy.com/2008/10/06/installing-php-53-on-mac-os-x-leopard/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>After many frustrating hours and <em>three</em> separate attempts I am finally running PHP 5.3.0alpha3 on my MacBook Pro using the default Leopard Apache installation (the one you can turn on/off with web sharing). This post is as much a summary for my own records as it is how-to to people in the same boat. I&#8217;d like to point out that I&#8217;m not very experienced with compiling software from source, and for some reason I was determined to utilise the default Leopard installation of Apache.</p>
<p>The problem with the whole process was the Apple compiled version of Apache runs at 64Bit, and at present it&#8217;s not possible to compile the  PHP 5.3 Apache module to be compatible. The solution is to cut the Apache binary back to run at 32Bit. That can be done quite simply and is explained by Tony Bibbs back in June with <a title="PHP 5.3 on Mac OS X 10.5" href="http://www.tonybibbs.com/article.php/PHP-5_3-on-10.5">PHP 5.3 on Mac OS X 10.5</a>.</p>
<p>Once you&#8217;ve cut Apache back to 32Bit, you just need to install MySQL.<em> Before I read Tony&#8217;s post I went to all the effort of compiling MySQL 5.1RC in 64Bit, then found out that PHP wasn&#8217;t compatible with the 64bit. </em>Installing a released version of MySQL is simple, and in my opinion not worth going through the effort of compiling from source (unless you need some special functionality). I just took the latest release from the <a title="Mysql Download" href="http://dev.mysql.com/downloads/mysql/5.0.html#macosx-dmg">MySQL download site</a> and installed it (<em>after removing numerious other versions first, see below</em>).</p>
<p>After MySQL was running, I downloaded the latest snapshot of PHP 5.3 from <a href="http://snaps.php.net/">snaps.php.net</a> , extracted, then ran the following configure command.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>php53 \
<span style="color: #660033;">--with-apxs2</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>apxs <span style="color: #660033;">--with-config-file-scan-dir</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>php53<span style="color: #000000; font-weight: bold;">/</span>php.d \
<span style="color: #660033;">--with-iconv</span> <span style="color: #660033;">--with-openssl</span>=<span style="color: #000000; font-weight: bold;">/</span>usr <span style="color: #660033;">--enable-ftp</span> <span style="color: #660033;">--enable-sockets</span> \
<span style="color: #660033;">--enable-mbstring</span> <span style="color: #660033;">--enable-calendar</span> <span style="color: #660033;">--enable-bcmath</span> \
<span style="color: #660033;">--with-curl</span>=shared,<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>php53 <span style="color: #660033;">--with-zlib-dir</span>=<span style="color: #000000; font-weight: bold;">/</span>usr  \
<span style="color: #660033;">--with-mysqli</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>mysql_config</pre></div></div>

<p>Note my use of &#8211;prefix=/usr/local/php53 &#8211; this was my choice, as I didn&#8217;t want it to potentially overwrite my php 5.2 installation that was there.</p>
<p>The important elements here are &#8211;prefix and &#8211;with-mysqli</p>
<p>Also &#8211; I&#8217;m not 100% on what &#8211;with-config-file-scan-dir does, but it caused no problems.</p>
<p>After configure succeeds I ran</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span></pre></div></div>

<p>Then after a cofee/beer I ran</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>From what I could gather, the install procedure created the libphp5.so file inside the /libexec/apache2/ directory (overwriting the one that was previously there), and also added the &#8216;loadModule&#8217; line within the apache config file @ /private/etc/apache2/httpd.conf. If I did this again, I would backup previous php libraries.</p>
<p>Finally, a sudo apachectl restart restarts the apache server and I was on my way.</p>
<p><strong>Footnotes: </strong></p>
<p>Here&#8217;s some locations I found useful</p>
<p>Apache&#8217;s Httpd.conf is @ /private/etc/apache2/httpd.conf</p>
<p>The APXS libraries are @ /usr/sbin/apxs</p>
<p>PHP &#038; MySQL (by default) install to /usr/local/</p>
<p><strong>MySQL</strong></p>
<p>Throughout this whole trial and error process, I think I installed MySQL about three different times. Before finally just downloading the latest 5.0 release I took some steps to remove the previous installations. If you&#8217;ve installed MySQL many times (like I did) and you&#8217;re a bit conscious about having junk all over the place then best place to start looking for information on what&#8217;s installed where is the <strong>Readme.txt</strong> file that comes with the OS X package installer,  and also the <a href="http://dev.mysql.com/doc/refman/5.0/en/mac-os-x-installation.html">Mysql Installation notes for OS X</a>.  </p>
<p>An article I found that also helped me search for some lost MySQL installs, and shed some light on what to do was this post titled <a title="Removing / Uninstalling MySQL" href="http://lee.hambley.name/archives/31">Removing MySql &#8211; by Lee Hambly</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thenetocracy.com/2008/10/06/installing-php-53-on-mac-os-x-leopard/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
