A few weeks back I helped a friend build PHP on a server with a non-standard directory structure. Changing the structure to use common defaults wasn’t an option, so we needed to adjust the PHP configure script to point to the pertinent places. Here is what we came up with:
$ export CPPFLAGS=”-I/home/apps/include -I/home/apps/include/mysql”
$ export LDFLAGS=”-L/home/apps/lib -L/home/apps/lib/mysql”
$ ./configure \\ --prefix=/home/apps/sfw/php-5.1.4 \\ --with-apxs2=/home/apps/httpd/bin/apxs \\ --with-libxml=/home/apps \\ --with-libxml-dir=/home/apps \\ --with-mysql=/home/apps \\ --with-zlib=/home/apps
This will build PHP using an apxs utility that resides in /home/apps/bin/apxs, and will look for the MySQL, libxml and zlib libraries and headers in /home/apps/lib and /home/apps/include.