PHP 5.3/5.4 for OS X 10.6/10.7 as binary package

Installation | Additional important notes | (Alternative) Installation by "hand" | Beta | Included extensions | Uninstall | Source code | Thanks | Support

Intro

This package installs the (usually) latest PHP 5.3.x/5.4.x on OS X 10.6 (aka Snow Leopard) and OS X 10.7 (aka Lion) in /usr/local/php5. It installs many useful extensions (see below) and ini-settings and is what we at Liip and Local.ch use for our development. It's especially suited for Symfony 2 development. It also provides a decent php.ini with all settings configured according to "Best Practices".

It doesn't install Apache, MySQL or any other external programs. It uses the Apache installation, which comes with OS X and for installing MySQL you can for example use Homebrew . The package is based on entropy's php package .

One Line Installation

All you need to do to install the whole thing is opening up a Shell and execute the following line:

PHP 5.3

curl -s http://php-osx.liip.ch/install.sh | bash -s 5.3

PHP 5.4

curl -s http://php-osx.liip.ch/install.sh | bash -s 5.4

It will ask you for your password. We install the packager in /usr/local/packer and PHP into /usr/local/php5 and for this, we need your password. We don't do anything bad with it.

Additional important notes

32 bit only systems (no workie)

It only works on a 64-bit-capable system. This means not on very old hardware with Intel Core Duo and Intel Core Solo processors (see http://support.apple.com/kb/ht3696 for the overview). If anyone wants to make it work on those systems too, please tell us how (We tried, but didn't came up with anything running in a decent amount of time)

php.ini

The php.ini is located in /usr/local/php5/lib/php.ini, additional config files are located in /usr/local/php5/php.d/. The php.ini is based on php.ini-development

Liip php.ini

The Liip php.ini for development is located in /usr/local/php5/php.d/99-liip-developer.ini.

Re-installs into new directory

All installed files go in a new directory with every update, you have to manually maintain/merge your changes from the old directory! (like pear installs)

apc,twig and xslcache

apc, twig and xslcache need to be enabled manually in /usr/local/php5/php.d/50-extension-$name.ini.

xdebug

xdebug settings needs to be configured (idekey etc) manually in /usr/local/php5/php.d/50-extension-xdebug.ini.

apache error with ulimit

If you are seeing "/usr/sbin/apachectl: line 82: ulimit: open files: cannot modify limit: Invalid argument" when loading apache, here is a fix

More history and all that

See this blog post for even more background info.

(Alternative) Installation by "hand"

If you don't trust us, here's the code of install.sh, which you can run by yourself (instead of the one-liner above):

curl -s -o /tmp/packager.tgz http://php-osx.liip.ch/packager/packager.tgz
sudo tar -C /usr/local  -xzf /tmp/packager.tgz
sudo /usr/local/packager/packager.py install tools-frontenddev

If you already have installed the packager and just want to update the PHP package, you can do it with the following line.

sudo /usr/local/packager/packager.py install tools-frontenddev

Beta installation

We provide also binaries for the upcoming versions, currently PHP 5.4, some extensions are missing, due to incompatibilities. Do the following:

curl -s http://php-osx.liip.ch/install.sh | bash -s beta

Included extensions

bcmath bz2 calendar Core ctype curl date dom dtrace ereg exif fileinfo filter ftp gd gettext hash iconv imap intl json ldap libxml mbstring mcrypt memcache memcached mhash mongo mssql mysql mysqli mysqlnd OAuth odbc openssl pcntl pcre PDO pdo_dblib pdo_mysql pdo_pgsql pdo_sqlite pgsql Phar posix Reflection session shmop SimpleXML soap sockets solr SPL SQLite sqlite3 standard sysvmsg sysvsem sysvshm tidy tokenizer uploadprogress wddx xdebug xhprof xml xmlreader xmlrpc xmlwriter xsl zip zlib Xdebug

available but disabled by default: apc, xslcache, twig

See this output of phpinfo() for more info.

Uninstall

Change in /etc/apache2/httpd.conf

LoadModule php5_module /usr/local/php5/libphp5.so

to

LoadModule php5_module        libexec/apache2/libphp5.so

also delete the file +php-osx.conf and +entropy-php.conf in /etc/apache2/other

and optionally remove /usr/local/php5-*

Source Code

Thanks

Thanks to Local.ch, which made all the groundwork for this. And thanks to Liip (and especially Patrick) for everything else.

Local.ch Liip

Support

We can't provide support for this, but Pull Requests are always welcome. And use the github issues page for filing bug reports.

Latest release