I recently updated my Powerbook G4 to a MacBook C2Duo, and I wanted to get working quickly so I cloned the hard drive from the PowerBook to the MacBook, and I was able to pick up working right where I left off, that is until I one of my Joomla projects stopped working.
One of my joomla projects was just returning me a blank page, no error message and nothing in the logs.. everything worked fine on the live sever, after about 6 hrs of banging my head on the keyboard, I had a genius idea. I powered up the old powerbook , and the project still worked there! I quickly realized the problem. I had done a custom compile of PHP on the powerbook, and it probably wasn’t working so well on the Intel MacBook.
The obvious solution was to recompile PHP, so I downloaded PHP 5.3, excited about the built in Mysql driver. Configure went fine, make went fine, and then I try to restart apache :
org.apache.httpd[79275] 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
OY!
So I found a solution , recompile Apache, and I wasn’t really in the mood for that, so I figured I’d try an older version of php.
I tried PHP 5.2.10 , and after some twiddling with config options and reinstalling MySql, configure, make, make install, and now my project is working again.
here is the configure command I used
CFLAGS='-arch x86_64' ./configure --without-iconv --with-apxs2 --enable-pdo --with-zlib=/usr --with-curl --with-mcrypt --with-pdo_mysql=/usr/local/mysql-5.1.37-osx10.5-x86_64/bin/mysql_config --with-mysqli=/usr/local/mysql-5.1.37-osx10.5-x86_64/bin/mysql_config --with-mysql=/usr/local/mysql-5.1.37-osx10.5-x86_64 --disable-dependency-tracking --prefix=/usr --without-mcrypt -mandir=/usr/share/man --infodir=/usr/share/info --with-apxs2=/usr/sbin/apxs --with-config-file-path=/private/etc --sysconfdir=/private/etc --enable-cli --with-curl=/opt/local --enable-ftp --enable-mbstring --enable-mbregex --enable-sockets --with-ldap=/usr --with-ldap-sasl --with-kerberos=/usr --with-mime-magic=/etc/apache2/magic --with-zlib-dir=/usr --with-gd --with-png-dir=/usr/X11R6 --with-xpm-dir=/usr/X11R6 --without-jpeg-dir --enable-exif
UPDATE
If you want or need libjpeg or true type support for things like imagettfbbox or imagejpeg. The needed libraries comple simply with a , configure, make, make install.
You can get them from here
http://www.ijg.org/files/jpegsrc.v7.tar.gz http://ftp.cc.uoc.gr/mirrors/nongnu.org/freetype/
Setting the appropriate environment variables also might help , but I’m not sure if this is required.
MACOSX_DEPLOYMENT_TARGET=10.5
CFLAGS="-arch x86_64 -g -Os -pipe -no-cpp-precomp"
CCFLAGS="-arch x86_64 -g -Os -pipe"
CXXFLAGS="-arch x86_64 -g -Os -pipe"
LDFLAGS="-arch x86_64 -bind_at_load"
export CFLAGS CXXFLAGS LDFLAGS CCFLAGS MACOSX_DEPLOYMENT_TARGET
be sure you get the newest version of freetype as some of the older versions won’t compile the shared libraries in 64 bit.
CFLAGS='-arch x86_64' ./configure --without-iconv --with-apxs2 --enable-pdo --with-zlib=/usr --with-curl --with-mcrypt --with-pdo_mysql=/usr/local/mysql/bin/mysql_config --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql=/usr/local/mysql --disable-dependency-tracking --prefix=/usr --without-mcrypt -mandir=/usr/share/man --infodir=/usr/share/info --with-apxs2=/usr/sbin/apxs --with-config-file-path=/private/etc --sysconfdir=/private/etc --enable-cli --with-curl=/opt/local --enable-ftp --enable-mbstring --enable-mbregex --enable-sockets --with-ldap=/usr --with-ldap-sasl --with-kerberos=/usr --with-mime-magic=/etc/apache2/magic --with-zlib-dir=/usr --with-gd --with-png-dir=/usr/X11R6 --with-xpm-dir=/usr/X11R6 --with-jpeg-dir=/usr/local --with-freetype-dir=/usr/local --enable-exif
One other thing I’d like to mention: If you use zsh you can do tab completion on php configure options, this has to be one of the awesomest things I’ve seen in a while.