Compiling httpd-2.2.16 and php-5.3.3 on Mac OS X 10.6.4

Probably because of upgraded ports packages, self-compiled PHP on MAMP suddenly became not to find libjpeg and some libraries. There’s a way to upgrade to MAMP1.9, but I’ve decided to switch to use self-compiled 64bit PHP.

Removed all macports packages.

% sudo port -f uninstall installed
% sudo port clean --work --archive all

For some reason, I installed Homebrew.

% brew install libjpeg
% sudo brew link libjpeg
% brew install libpng
% sudo brew link libpng
% brew install gettext
% sudo brew link gettext
% brew install readline
% sudo brew link readline

I couldn’t find those packages on brew, so used ports.

% sudo port install t1lib
% sudo port install freetype

Then, compiled apache and php.

apache% ./configure --enable-so --enable-rewrite --enable-usertrack
% make && make install
php% ./configure \
--with-apxs2=/usr/local/apache2/bin/apxs \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-freetype-dir=/opt/local \
--enable-bcmath \
--enable-ftp \
--enable-gd-native-ttf \
--with-bz2=/usr \
--with-ldap \
--with-sqlite \
--with-t1lib=/opt/local \
--enable-mbstring=all \
--with-curl \
--enable-sockets \
--enable-bcmath \
--enable-soap \
--with-kerberos \
--enable-calendar \
--enable-exif \
--with-libxml-dir \
--disable-xmlreader \
--with-gettext \
--with-openssl \
--without-iconv \
% make && make install

Also, installing pecl is needed.

That’s it.

It seems Zend Framework uses iconv, so I need it now. There’s a link issue with default libiconv (/usr) or even ports (/opt/local). I’ve downloaded and compiled libiconv-1.13.1 from source. And, probably this is important, I moved /usr/lib/libiconv.* to /tmp. Otherwise you’ll get some linker errors like “ld: symbol(s) not found”. Then,

% make distclean
% ./configure ...--with-iconv-dir=/usr/local...
% make && make install

I’ve added ‘–disable-ipv6’ to fix “php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known” error while accessing remote URL with file_get_contents or so.

This entry was posted in Tweak and tagged , , , . Bookmark the permalink. Both comments and trackbacks are currently closed.