Depending on which version of Apache 2 you have, you may download certain version of the php.
I went through a lot to get this working. Part of the problem is that I was confused by the bundled version of the Apache with Solaris and I couldn’t figured out where is where as there were two copies of the Apache 2. Anyway, hopefully the following instruction is not too confusing.
I had the Apache 2 version 2.2.4 (downloaded from sunfreeware.com), so I downloaded PHP 5.2.3 from Sunfreeware.com.
PHP needs configuration. php.ini related files are in /usr/local/php/doc/php along with other documentation. php.ini needs to be installed in /usr/local/php/lib. The libphp5.so file is installed in /usr/local/apache2/modules by default. The following two lines
LoadModule php5_module modules/libphp5.so
AddType application/x-httpd-php .php
need to be placed in your httpd.conf file in their appropriate places.
The httpd.conf is normally stored in /usr/local/apache2/conf directory.
Run the following command to restart Apache 2, now with php feature.
# /usr/local/apache2/bin/apachectl restart