Warning: I know almost nothing about PHP. I haven't verified that building PHP in the manner that I suggest results in a completely functional build of PHP.
Please review http://www.php.net/manual/en/install.apache2.php, which contains information on using PHP with Apache 2 on Linux. The document you are reading will attempt to describe any special AIX nuances you may encounter.
Note: The PHP folks don't recommend using PHP with Apache 2 at all on any platform. Some people believe that it is safe to use PHP with Apache 2 as long as you are using the prefork MPM with Apache 2. Your mileage may vary.
configureIn this example, /home/trawick/2048gcc is where Apache
is installed, /home/trawick/php434gcc is where I will
install PHP, and I'm using gcc for the compiler.
$ CC=gcc ./configure --prefix=/home/trawick/php434gcc \ --with-apxs2=/home/trawick/2048gcc/bin/apxs
make$ make
make installmake install failed for me. Instead, I manually
copied the PHP DSO to the Apache modules directory:
$ cp -p .libs/libphp4.so /home/trawick/2048gcc/modules/
Add this line to httpd.conf:
LoadModule php4_module modules/libphp4.so
then see if apachectl configtest still works.
Add this line to httpd.conf:
AddType application/x-httpd-php .php .phtml
Create this simple PHP page as file phpinfo.php under your Apache htdocs directory:
<html> <head> <title>PHPinfo</title> </head> <body bgcolor=#FFFFFF> <p><? phpinfo() ?></p> </body> </html>
% apachectl startMake sure Apache started and you didn't get any segfaults from a bad PHP build.
If you get a nicely formatted table describing PHP settings, PHP is working. If you get the PHP source code back to the browser then the Apache configuration to invoke PHP for *.php files isn't working right.
% gzip -dc php-4.3.0.tar.gz | tar -xf-
% cd php-4.3.0 % ./configure --prefix=/jeff/trawick/phpinst --with-apxs2=/jeff/trawick/apacheinst/bin/apxs(substitute your desired PHP install path for /jeff/trawick/phpinst and substitute your Apache install path for /jeff/trawick/apacheinst)
Note: Some of the lines in Makefile are too darn long for native vi. You may wish to use emacs instead.
Replace
EXTRA_LDFLAGS = -Wl,-bI:/jeff/trawick/apacheinst/bin/httpd.exp -avoid-version -modulewith
EXTRA_LDFLAGS = -Wl,-brtl -Wl,-bI:/jeff/trawick/apacheinst/modules/httpd.exp -avoid-version -module -L/opt/freeware/GNUPro/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/2.9-aix43-010414/powerpc -lgccBe sure to replace the path /opt/freeware/GNUPro/.../powerpc" with the path to libgcc.a on your system.
This replacement for the definition of EXTRA_LDFLAGS fixes three problems:
% make
PHP's "make install" doesn't work. PHP apparently builds the DSO just a bit different than apxs would have, and apxs (or rather its helper script instdso.sh) blows up.
cp -p .libs/libphp4.so.0 ~/apacheinst/modules/(Replace ~/apacheinst with the path to your Apache installation.) If you see a message like this
cp: /jeff/trawick/apacheinst/modules/libphp4.so.0: Cannot open or remove a file containing a running program.either switch to root and run /usr/sbin/slibclean or manually remove the old copy.
LoadModule php4_module modules/libphp4.so.0
<Files *.php> SetOutputFilter PHP SetInputFilter PHP AcceptPathInfo On LimitRequestBody 5524288 </Files>Create this simple PHP page as file phpinfo.php under your Apache htdocs directory:
<html> <head> <title>PHPinfo</title> </head> <body bgcolor=#FFFFFF> <p><? phpinfo() ?></p> </body> </html>
% apachectl startMake sure Apache started and you didn't get any segfaults from a bad PHP build.
If you get a nicely formatted table describing PHP settings, PHP is working. If you get the PHP source code back to the browser then the Apache configuration to invoke PHP for *.php files isn't working right.
EXTRA_LDFLAGS="-L/opt/freeware/GNUPro/lib/gcc-lib/powerpc-ibm-aix5.1.0.0/2.9-aix43-010414/powerpc -lgcc" ./configure --prefix=/jeff/trawick/phpinst --with-apxs2=/jeff/trawick/apacheinst/bin/apxs
% cantloaddso.pl ~/apacheinst/modules/libphp4.so.0 ~/apacheinst Your DSO should be able to resolve all ap_ symbols. If it won't load, perhaps it is due to one of these symbols: __udivdi3 __divdi3 %