Installing PHP 5.3 with MacPorts

I’m using MacPorts on my iMac and my MacBook Pro for PHP development. Yesterday I mentioned that MacPorts switched their stable PHP 5 package from PHP 5.2.10 to PHP 5.3.0 and I decided to do the switch as well. Upgrading packages with MacPorts is very easy, it’s just a

imac:~ thorsten$ sudo port upgrade outdated

Just hit enter and MacPorts starts to build all packages which have to be updated. My problem was that PHP 5.3.0 didn’t installed automatically:

Error: Target org.macports.activate returned: Image error:
/opt/local/include/php/ext/ereg/php_ereg.h already exists and
does not belong to a registered port.  Unable to activate port php5.

So I tried to uninstall the PHP 5 package and re-install it once again. But also the same problem the second time. So I decided to do the hard way and I removed all the PHP library stuff.

imac:~ thorsten$ rm -rf /opt/local/include/php
imac:~ thorsten$ rm -rf /opt/local/include/php

Now I tried it once again:

imac:lib thorsten$ sudo port install php5 +apache2 +macosx +mysql5 +pear +postgresql83 +sqlite
--->Â  Installing php5 @5.3.0_0+apache2+macosx+mysql5+pear+postgresql83+sqlite
--->Â  Activating php5 @5.3.0_0+apache2+macosx+mysql5+pear+postgresql83+sqlite
You may need to update your php.ini for any changes that have been made
in this version of php. Compare /opt/local/etc/php5/php.ini with
/opt/local/etc/php5/php.ini-development (if this is a development server) or
/opt/local/etc/php5/php.ini-production (if this is a production server).

If this is your first install, you need to activate PHP in your web server.

To enable PHP in Apache, run
 cd /opt/local/apache2/modules
 /opt/local/apache2/bin/apxs -a -e -n "php5" libphp5.so
--->Â  Cleaning php5

Then I restarted Apache… and PHP 5.3.0 is running on my iMac! :-)

3 thoughts on “Installing PHP 5.3 with MacPorts

  1. nice one, but they don’t have dtrace. better remove it and build your own PHP.

  2. pity, the php5 port does not have postgresql84 variant yet… (But, postgresql84 port is made available)…

  3. :( another problem I’ve noticed today – Zend Optimizer is not compatible with PHP 5.3.x…

Comments are closed.