Upgrade PHP5 on Yosemite

ImagePng() and imagecreatefrompng() do not seem to work with the included version of PHP5 on Mac OS X Yosemite. Unfortunately I needed the first function while working on a pet project.

The kind souls at http://php-osx.liip.ch/ made a painless upgrade available to replace the existing PHP installation. Install it using the command below:

curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6
The install script will install the binaries into /usr/local/php5 and configures apache to use that version instead of the default one.

If you want to use the PHP-CLI you need to modify your shebang into: #!/usr/local/php5/bin/php


Since Yosemite the default installation of MySQL on Macports is not working correctly anymore. Installation of mysql56 of Macports solves this problem, but that server stores its mysql.sock file in a non default place. You need to make the new PHP aware of the new socket location. Over here you can find more information on how to make your PHP MySQL extensions (mysql, pdo_mysql and mysqli) aware of that socket file. The newly installed PHP has its *php.ini* in */usr/local/php5/lib/*.

This article is my 22nd oldest. It is 179 words long, and it’s got 0 comments for now.