At the urging of @akrabat at #tek13, I decided to see if I could compile #php 5.5 on my cleanly installed Mountain Lion. Here is how it went.
Get a git client. ML does not come with one by default. I decided to install SourceTree from Atlassian as I have a Bitbucket there as well. You could also use the GitHub client, or use the Command Line Tools from Xcode.
Speaking of Xcode, ML does not include the standard *nix command line tools you would expect as a developer. You will need to grab them of course.
And of course, it does not include everything you need. Autoconf is missing. Lets install that before we get going.
curl -OL http://ftpmirror.gnu.org/autoconf/autoconf-2.68.tar.gz tar xzf autoconf-2.68.tar.gz cd autoconf-2.68 ./configure --prefix=/usr/local make sudo make install
Now we have what we need. Grab the php source! Most of what you need to know about this is on the php git page.
cd dir_where_i_build_things git clone https://github.com/php/php-src.git cd php-src
We are ready to build! The starting point is buildconf
Now is a tricky part, deciding what to configure php with. You could grab the output of “php -i” from your current php install and use those. I decided to use a slightly modified line from what OSX comes with. (for instance, I don’t use pgsql)
./configure --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 --disable-cgi --with-curl=/usr --enable-mbstring --enable-mbregex --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --with-mysql-sock=/var/mysql/mysql.sock --with-libedit --with-readline=/usr --enable-shmop --with-snmp=/usr --enable-soap --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-tidy --with-iconv-dir=/usr --enable-zip
It looks like some config options are not recognized between the default ML install and 5.5.
--enable-sqlite-utf8 --enable-suhosin --enable-zend-multibyte
So, without them we get all teh way through and are ready for compiling.
Will it blend? Well, a fair number of warnings streamed by throughout the build. If I get the time I might look at some, perhaps at the #tek13 hackathon. But alas! It did not compile for me this time.
/bin/sh /Users/gwilson/code/php-src/libtool --silent --preserve-dup-deps --mode=compile cc -Iext/standard/ -I/Users/gwilson/code/php-src/ext/standard/ -DPHP_ATOM_INC -I/Users/gwilson/code/php-src/include -I/Users/gwilson/code/php-src/main -I/Users/gwilson/code/php-src -I/Users/gwilson/code/php-src/ext/date/lib -I/Users/gwilson/code/php-src/ext/ereg/regex -I/usr/include/libxml2 -I/Users/gwilson/code/php-src/ext/mbstring/oniguruma -I/Users/gwilson/code/php-src/ext/mbstring/libmbfl -I/Users/gwilson/code/php-src/ext/mbstring/libmbfl/mbfl -I/Users/gwilson/code/php-src/ext/sqlite3/libsqlite -I/usr/include/tidy -I/Users/gwilson/code/php-src/TSRM -I/Users/gwilson/code/php-src/Zend -no-cpp-precomp -I/usr/include -g -O2 -fvisibility=hidden -c /Users/gwilson/code/php-src/ext/standard/base64.c -o ext/standard/base64.lo /Users/gwilson/code/php-src/Zend/zend_language_parser.y:50.1-5: invalid directive: `%code' /Users/gwilson/code/php-src/Zend/zend_language_parser.y:50.7-14: syntax error, unexpected identifier make: *** [/Users/gwilson/code/php-src/Zend/zend_language_parser.c] Error 1
Out of battery power now. More later.