How to make apache work with PHP5 by default?


I am running Virtualmin Pro on CentOs 4.6. This is used for virtual hosting. I have a virtual domain whose php script requires PHP5. I have installed php5 based on the docs I have found here. However, the script requires execution mode as Apache mod_php (run as Apache’s user). When I changed to this mode, it only recognises PHP4 which is installed by default when I installed virtualmin.

Please advise how to have php5 recognise by Apache by default.

Thanks in advance.

There’s a FAQ about this, somewhere…but, here’s the summary:

Only one mod_php version can be loaded into Apache at once.

So, you need to disable mod_php version 4, by editing /etc/httpd/conf.d/php.conf, and comment everything out (add a # before any LoadModule and AddType lines that don’t already have them). Then edit /etc/httpd/conf.d/php5.conf and uncomment (remove the # mark) from the LoadModule line, and the AddType line. Restart the httpd service, and test.