Updating CentOS server to PHP5 default

Hi all, can anyone tell me the steps needed to convert a CentOS server 4.6 to use PHP5 as the default on all web applications? Installing PHP5 is no problem, but I cannot seem to find a way to make it the one used by default.

Thanks a bunch,

You haven’t mentioned whether you’re using Virtualmin Professional or GPL. Professional makes it switchable in the UI, GPL you have to decide for the whole system (or manually configure it for each virtual host).

You also haven’t mentioned whether you’re running PHP under mod_php or mod_fcgid+suexec.

I’m on Professional Virtualmin… and also using mod_php

I suppose I’m blind, I don’t see the UI option anywhere. But changing it for the whole system is no problem for me, if needed.


Switch to FCGId and you’ll be able to choose between php4 and php5, as needed, assuming both are installed.

If you want to switch the mod_php version, just edit the appropriate php*.conf files in /etc/httpd/conf.d and uncomment the one you want and comment out the one you don’t–note that you MUST comment out the other when you enable one. Apache will crash with mysterious error messages if you do not.

I’m being very emphatic, because it seems whenever I explain this process, folks enable the one they want without disabling the prior choice…and then come back asking why Apache doesn’t work anymore. You cannot load mod_php4 and mod_php5 simultaneously.

Anyway, we recommend mod_fcgid and suexec. It’s as fast as mod_php and adds security by running under suexec. But, you do have to modify permissions and ownership of any scripts you have running under mod_php–any apps that run under suexec have to be owned by the virtual server account, and they cannot be group or world writable (so, you want 755 or lower permissions on scripts, or they will not run–750 is probably the highest you should ever need to go, and even lower is better).

you are probably aware that webmin has (or had in the meantime) a bug that revealed the mysql root password in the Environment under mod_php.
to solve that look for "variables_order= stanza" in the php.ini, then update it to show "GPCS" thus taking out the "E" if not done already.

I discovered this when switching from mod_fgcid to mod_php on 1 domain…however Jamie would fix this in the next release so it might already be fixed.