Monday, August 17, 2009

Multiple PHP in a machine blues

I am compiling PHP's source code and a PHP extension (apc). The reason for not using packaged version of PHP is that there is another critical application running in the server, with its own PHP version, and we don't want to risk incompatibility issues forcing the application run with a different PHP version. Meanwhile I need PHP compiled with debug flags, and also with gd enabled and apc extension for another application. I prefer Debug flags to be enabled because we're testing this whole stuff and don't want to be in the dark when error (s) cropped up (previous set of PHP-apache-oci8 triad sometimes issued segmentation faults but we don't now the source of the errors).

The problem is, that the apc Makefile won't use the debug flag set during previous PHP compilation. It turns out that we must be very careful that:
  • the phpize being used is from the correct PHP compilation (I deleted the scripts/phpize and scripts/php-config after changing PHP's configure parameters, then invoke make install on PHP)
  • no other phpize or php-config is being run, especially by setting the PATH environment variable so the path to the correct phpize/php-config is the first directory listed in the PATH.
The second item is blocked me for some time, I didn't realize that the phpize - configure - make phase invoked php-config plainly (using the PATH). Because there is several PHP installation in the system, the php-config being run is from the other installation (the root administrator installed the other PHP binaries in the normal location such as /usr/local/bin).

No comments: