PhpRiot
News Archive
PhpRiot Newsletter
Your Email Address:

More information

PHP 5.3 for OS X 10.6 one-line installer

Note: This article was originally published at Planet PHP on 13 April 2011.
Planet PHP

Apple computers and OS X are quite common here at Liip (and local.ch) as developer machines. But while OS X comes with a not-too-old PHP installation, it nevertheless doesn't have everything we need (for example the infamous intl extension) and it's not that easily extendable with self-compiled extensions.

The first reaction to that situation was usually to install one of the many available solutions to get everything we need. Like MAMP, XAMPP or install it with a package manager like homebrew or MacPorts or even compile it by yourself. That usually worked, but as a consequence we had a very heterogenous setup and for every new Liiper we needed to set that up and it usually took ages. And then came this fancy new extension and we had to invest quite some time to get it set up on the different installations.

Our friends at local.ch took this very dissatisfying situation in their own hands, forked the build-entropy-php script from Marc Liyanage's great entropy work, extended and adjusted it to their (and our) needs. They also built a nice packager and installer around and finished the "install this and you're set in 5 minutes" procedure.

People at Liip started using the package, we added more extensions we needed and one day we decided, that this is the only officially supported way to get PHP on your Apple computer. And it was a very good decision, people getting a new Mac now have a recent and full blown PHP installed in less than 5 minutes.

Enough, talking, want to try it out for yourself? Go to http://php-osx.liip.ch/ and follow the instructions. It's really copy&pasting one line into your shell.

The package only installs PHP into /usr/local/php5, it uses the "built-in" apache server and leaves the shipped PHP alone. It also doesn't include MySQL or PostgreSQL or any other server software, you still have to install those by yourself. But it comes with all the extensions needed to access those servers. See the phpinfo() output to see what all comes with it.

We also ship Liip-recommended php.ini settings (for developers, not for production) so that we can make sure, that everyone is using the same settings.

If you want to build your own distribution (because you want to host that internally or have different extensions), everything needed to do that is on github. build-entropy-php is the stuff needed to actually build PHP and all the needed extensions and libraries (if you just want your own custom-built php, that's all what you need). php-osx are the scripts needed to build the tar for the package, build the php-osx.liip.ch webpage and upload everything. And the packager is the script needed for downloading and installing the package (written mainly by local.ch and in python)

The php-osx.liip.ch website runs completely on S3. Since Amazon made it possible to host your static website on S3, we can provide such a service without having to run a machine somewhere. As a benefit of this, it will be highly reliable, I just hope the data transfer bill doesn't kill us :) If you want to provide your own package, you don't need S3, it should run on any server which can deliver static pages.

And as a last remark: We can't provide end-user support for this. If you don't know what a shell is and how to edit a configuration file, this is may be not for you (but you actually don't have to edit a configuration file in 99% of all cases). We have it running on dozens of machines and it runs fine for us. If it doesn't for you, it most certainly is an error on your side. Pull Requests are of course always welcome and you can nevertheless use the github issues page for filing bug reports.

Thanks to local.ch for all the work they did on all the infrastructure needed for this and for contributing this back to the community. It will certainly help a lot of PHP developers with OS X 10.6 to get a decent PHP up and running within minutes.

Technorati Tags: osx