mamp

Custom MAMP on Mac OS 10.5 Leopard

I wasn't able to get xdebug or Zend Debugger to work on my install of Mac OS 10.5 Leopard after trying the XTools version of PHP5 that now comes with the operating system, so I broke down and compiled PHP5 from scratch thinking it would make life easier in the end and finally get support for an mcrypt project I have on the todo list. I suspect it has to do with Leopard introducing 64 bit XTools software whereas xdebug and Zend Debugger were compiled for a 32 bit environment.

First, you should install XTools from the Leopard DVD and this installation process will just replace the Apache and PHP5 files that XTools installs and leave all the other configuration needed to get it to work in place.

I grabbed a source snapshot of PHP 5.2 from snaps.php.net because there have been scattered reports of problems compiling 5.2.4 from source on Mac, which is apparently fixed in snaps. This configure line made a successful compile of PHP 5.2.5RC3-dev with various extensions for linking to MySQL 5.1.22.

./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-apxs2=/usr/sbin/apxs --enable-cli --with-zlib-dir=/usr --enable-mbstring --enable-mbregex --enable-sockets --with-curl=/usr --with-config-file-path=/etc --sysconfdir=/private/etc --with-mysql-sock=/tmp/mysqld.sock --with-pear=/Library/PHP --without-iconv --without-openssl --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql/bin/mysql_config --with-mcrypt --with-xmlrpc --with-bz2 --with-curl --with-zlib-dir=/usr --with-jpeg-dir=/usr/local/lib --with-png-dir=/usr/X11R6 --with-freetype-dir=/usr/X11R6 --with-xpm-dir=/usr/X11R6 --with-pgsql

make
sudo make install

The MySQL config comes from installing the MySQL 5.1.22 official binaries to /usr/local/mysql.

The problem was when I loaded Apache, I couldn't connect. Console told me

httpd: Syntax error on line 114 of /private/etc/apache2/httpd.conf: Cannot load /usr/libexec/apache2/libphp5.so into server: dlopen(/usr/libexec/apache2/libphp5.so, 10): no suitable image found. Did find:\n\t/usr/libexec/apache2/libphp5.so: mach-o, but wrong architecture

Apparently this is because the custom compile I did is 32 bit and the new pre-packaged Apache is 64 bit, so I recompiled Apache, too.

./configure --enable-layout=Darwin --enable-mods-shared=all
make
sudo make install

Of course later, I realized Drupal 6 status page complains if GD isn't installed, so I found http://www.veola.net/macintosh/adding-gd-library-for-mac-os-x-leopard which even has the instructions on making GD a PHP extension so I didn't have to recompile all of PHP5. I used a more updated version of libpng because the one in the instructions didn't compile.


Syndicate content