In the past I’ve always installed Apache2 via MacPorts, MySQL from source or binary, and built PHP from source. While putting this all together on Snow Leopard, I decided to install MySQL from MacPorts as well:
1
$ sudo port -v install apache2 mysql5-server
After everything was built and installed, I then installed the dependencies I needed for PHP 5.3 from MacPorts (openssl, mcrypt, libxml, etc.). My full configure command is:
Notice –with-mysql=/usr/local/mysql? No matter how many paths I tried I could not get PHP to con- figure with MySQL. Apparently the MacPort changes the layout for some reason. My solution (inspired by a 2007 discussion on the MacPorts mailing list) involved making a few symlinks:
1234567
$ sudo mkdir -p /usr/local/mysql
$ cd /usr/local/mysql
$ sudo ln -s /opt/local/include/mysql5 include
$ sudo ln -s /opt/local/lib/mysql5 lib
$ sudo mkdir bin
$ cd bin
$ sudo ln -s /opt/local/bin/mysql_config5 mysql_config
Once the symlinks were in place, PHP configured without error.