Monday, June 15, 2009

Installing PHP as a Shared Module in APACHE HTTPD Server @ Open Solaris/ Solaris 10

Environment Details

cc = /usr/bin/cc
make = /usr/bin/make
Apache root = /export/home/Apache2.2.9/httpd-2.2.9_build/php
Src php = /export/home/php-5.2.6/php-5.2.6
Src Apache httpd= /export/home/Apache2.2.9/httpd-2.2.9_src

Setting the PATH

bash-3.2# export PATH=/usr/bin/cc:/usr/bin/make:$PATH

Building Apache httpd

bash-3.2#/export/home/Apache2.2.9/httpd-2.2.9_src/configure --prefix=/export/home/Apache2.2.9/httpd-2.2.9_build
bash-3.2#make
bash-3.2#make all

Start Apache HTTPD Server

bash-3.2#/export/home/Apache2.2.9/httpd-2.2.9_build/bin/apachectl start

Go to the following URL at Browser

http://localhost

The response at the browse should be "It works!".

Stop Apache HTTPD Server

/export/home/Apache2.2.9/httpd-2.2.9_build/bin/apachectl stop

Building PHP

./configure --prefix=/export/home/Apache2.2.9/httpd-2.2.9_build/php --with-apxs2=/export/home/Apache2.2.9/httpd-2.2.9_build/bin/apxs --with-config-file-path=/export/home/Apache2.2.9/httpd-2.2.9_build/php

bash-3.2# make
bash-3.2# make all

Configure Apache HTTPD with PHP

Add the following line to file 'Apacheroot/conf/httpd.conf'

LoadModule php5_module modules/libphp5.so

Note : # is a comment here @ Apache conf file...

Add the following mapping for PHP to invoke PHP parser for PHP files in the same conf file.
AddType application/x-httpd-php .php

Create PHP file

create a file named info.php @ /Apacheroot/htdocs
phpinfo();
?>

cp /export/home/php-5.2.6/php-5.2.6/php.ini-dist /export/home/Apache2.2.9/httpd-2.2.9_build/php/php.ini

Restart Apache HTTPD Server

$ /export/home/Apache2.2.9/httpd-2.2.9_build/bin/apachectl restart

Access the pho file as
http://localhost/info.php in a browser

The response shows the php configuration.

No comments:

Post a Comment