Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save vihuvac/6719037 to your computer and use it in GitHub Desktop.
Save vihuvac/6719037 to your computer and use it in GitHub Desktop.

Upgrading the Native PHP Installation on Mac OS X 10.8 (Mountain Lion), 10.9.1 (Mavericks) to PHP 5.4.24

Note: This installation will replace the original shipped PHP version.

You may want to change this by modifying the directories from /usr to /usr/local on ./configure directive.

Or, just try this configuration instead.

Pre-requisites:

Dependencies:

$ brew install libjpeg
$ brew install pcre
$ brew install libxml2
$ brew install mcrypt
$ brew install imap-uw

ICU - International Components for Unicode:

To support internationalization, download ICU from it's official website.

Then install it:

$ tar xzvf icu4c-51_2-src.tgz
$ cd icu/source
$ ./runConfigureICU MacOSX
$ make
$ sudo make install

via homebrew

$ brew install icu4c
$ brew link icu4c --force

PHP Installation:

$ sudo tar xvf ~/Downloads/php-5.4.24.tar.bz2
  • Configure the makefile:
$ cd php-5.4.24

$ ./configure \
--prefix=/usr \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--sysconfdir=/private/etc \
--with-apxs2=/usr/sbin/apxs \
--enable-cli \
--with-config-file-path=/etc \
--with-libxml-dir=/usr \
--with-openssl=/usr \
--with-kerberos=/usr \
--with-zlib=/usr \
--enable-bcmath \
--with-bz2=/usr \
--enable-calendar \
--with-curl=/usr \
--enable-dba \
--enable-exif \
--enable-ftp \
--with-gd \
--enable-gd-native-ttf \
--with-icu-dir=/usr/local \
--with-iodbc=/usr \
--with-ldap=/usr  \
--with-ldap-sasl=/usr \
--with-libedit=/usr \
--enable-mbstring \
--enable-mbregex \
--with-mcrypt=/usr \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-readline=/usr \
--enable-shmop \
--with-snmp=/usr \
--enable-soap \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--with-tidy \
--enable-wddx \
--with-xmlrpc \
--with-iconv-dir=/usr \
--with-xsl=/usr \
--enable-zip \
--with-imap=/usr/local/imap-2007 \
--with-kerberos \
--with-imap-ssl \
--enable-intl \
--with-pcre-regex \
--with-pgsql=/usr \
--with-pdo-pgsql=/usr \
--with-freetype-dir=/usr/X11 \
--with-jpeg-dir=/usr \
--with-png-dir=/usr/X11
  • Once done, run a test in order to test the compilations and find any error.
$ make test

This runs make and tests the compilation. This might take a while, up to 30 minutes, because every single facet of PHP is being tested. When finished, if PHP found any errors (and it probably will) report them to the developers by following the on-screen instructions. Don’t worry, everything is still fine - the errors it finds are usually less than important.

  • Finally, make and install the binaries:
$ make
$ sudo make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment