Skip to content

Instantly share code, notes, and snippets.

@mikemorris
Created March 23, 2012 02:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save mikemorris/2166324 to your computer and use it in GitHub Desktop.
Save mikemorris/2166324 to your computer and use it in GitHub Desktop.
Build PHP 5.4.0 from source with i18n support for MacOS X 10.7 Lion
# Download, configure, make and install International Components for Unicode
wget http://download.icu-project.org/files/icu4c/49.1/icu4c-49_1-src.tgz
tar xzvf icu4c-49_1-src.tgz
cd icu/source/
./runConfigureICU MacOSX
make
sudo make install
# Install libjpeg support for GD
brew install jpeg
# Download, configure, make and install PHP 5.4.0
# This config replicates the default PHP 5.3.8 install as closely as possible (while adding i18n support), but installs to /usr/local instead of clobbering the default install in /usr
wget http://us.php.net/get/php-5.4.0.tar.gz/from/www.php.net/mirror
tar xzvf php-5.4.0.tar.gz
cd php-5.4.0
./configure --with-apxs2 --disable-short-tags --with-config-file-path=/etc --with-openssl --with-kerberos --with-zlib --enable-bcmath --with-bz2 --enable-calendar --with-curl --enable-dba --with-ndbm --enable-exif --enable-ftp --with-gd --with-freetype-dir=/usr/X11 --with-png-dir=/usr/X11 --enable-gd-native-ttf --enable-intl --with-iodbc --with-ldap --with-ldap-sasl --with-libedit --enable-mbstring --enable-mbregex --with-mysql --with-mysqli --with-pdo-mysql --with-mysql-sock=/var/mysql/mysql.sock --with-readline --enable-shmop --with-snmp --enable-soap --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-tidy --enable-wddx --with-xmlrpc --with-xsl --enable-zip --with-pcre-regex --with-pgsql --with-pdo-pgsql --enable-intl
make
sudo make install
# Move default php.ini and download most recent version from SVN
sudo mv /etc/php.ini /etc/php.ini-5.3.8-previous
sudo wget --output-document=/etc/php.ini http://svn.php.net/viewvc/php/php-src/trunk/php.ini-production?view=co
# Install autoconf dependency for PEAR/PECL
brew install autoconf
# Install xdebug and APC
sudo pecl install xdebug
sudo pecl install apc
# Disable apc extension, segfaults on 5.4.0 (patched in SVN https://bugs.php.net/bug.php?id=60845)
# Enable xdebug extension
sudo bash -c "cat >> /etc/php.ini" <<EOF
; extension=apc.so
zend_extension="/usr/local/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so"
EOF
# Restart apache
sudo apachectl graceful
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment