Compiling PHP 5.2 With Iconv, Soap, and Others on OS X 10.5
Categories: Software, Web Development
I’ve already posted some notes about compiling PHP 5.2 on OS X 10.5, but I came across a couple more issues today as I recompiled the binary with soap support. After searching around a bit I finally remembered that I needed to manually edit the make file in order to get PHP compiling correctly, I found the edit that needed to be made here. I’m reposting it here for my own future use:
Replace:
[code lang=”bash”]
$(CC) $(MH_BUNDLE_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(PHP_GLOBAL_OBJS:.lo=.o) $(PHP_SAPI_OBJS:.lo=.o) $(PHP_FRAMEWORKS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) -o $@ && cp $@ libs/libphp$(PHP_MAJOR_VERSION).so
[/code]
With this:
[code lang=”bash”]
$(CC) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(PHP_GLOBAL_OBJS:.lo=.o) $(PHP_SAPI_OBJS:.lo=.o) $(PHP_FRAMEWORKS) $(EXTRA_LIBS) $(ZEND_EXTRA_LIBS) $(MH_BUNDLE_FLAGS) -o $@ && cp $@ libs/libphp$(PHP_MAJOR_VERSION).so
[/code]
Note the separation of the command into three separate lines, with the 2nd line having one tab character at the beginning of the string.
And here is my updated configure string command (with soap and iconv):
[code lang=”bash”]
./configure –prefix=/usr –sysconfdir=/private/etc –with-libxml-dir=/opt/local –with-icu-dir=/opt/local –with-iconv=shared,/opt/local –enable-intl –with-config-file-path=/etc –mandir=/usr/share/man –infodir=/usr/share/info –with-apxs2=/usr/sbin/apxs –with-zlib-dir=/usr –with-mysql-sock=/var/mysql –with-mysqli=/usr/local/mysql/bin/mysql_config –with-pdo-dblib=/opt/local –with-mysql=/usr/local/mysql –with-pear –with-pdo-mysql=/usr/local/mysql/bin/mysql_config –enable-sockets –enable-exif –enable-wddx –enable-ftp –enable-cli –enable-mbstring –enable-mbregex –enable-sockets –with-curl –with-sqlite –enable-soap –with-libxml-dir=/usr
[/code]
Another interesting note about PHP 5 is that compiling it with the readline extension (using --with-readline
or --with-libedit
) allows it to be a interactive scripting environment (a PHP console of sorts) just like python, ruby, or bash. Just run it from the command line with the -a option (info thanks to madmac).