Upgrade to PHP 5.5 or 5.4 on Mac OSX 10.9 Mavericks and OSX 10.8

OSX 10.9 Mavericks ships with PHP 5.4.17 and OSX 10.8 Mountain Lion ships with PHP version 5.3, there is an easy upgrade method to either the old stable PHP 5.4 or the newer stable version 5.5.

The latest PHP version in this guide is from this PHP Packaged site  which is being maintained for OSX and is known as a reliable source.

Download and Install PHP5.4

Open the Terminal and issue one command -


That’s it! One line command in the terminal, this will download and install PHP5.4 in:

The install script will also disable the previous PHP5.3 if it was enabled in the Apache configuration file httpd.conf . The new 5.4 version is enabled in Apache right off the bat.

Test the php version by creating a php file named phpinfo.php in your web root with the single function:

Browse to that file and see the version displayed.

phpinfo-54 osx


Download and Install PHP5.5

The install leaves the original version of PHP that shipped with the OS intact and that original version will still be displayed if you do a php -v at the command line, however the older shipped php version is disabled from the httpd.conf with the php path commented out:

The install creates a new apache directive that loads the newer php from :

One of the good things about using the packaged versions here is that they already have additional extensions compiled and enabled such as mcrypt and all these other gems… bcmath bz2 calendar Core ctype curl date dom dtrace ereg exif fileinfo filter ftp gd gettext hash iconv imap intl json ldap libxml mbstring 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 wddx xdebug xhprof xml xmlreader xmlrpc xmlwriter xsl zip zlib Xdebug