Strange php issue


I installed virtualmin on a just built -and updated- centos 5. After virtualmin installation is complete, I created my primary virtual server. Everything worked OK up to here.

Then i installed squirrelmail package from official centos repository. I restarted apache to make it read squirrelmail.conf in /etc/httpd/conf.d. Then I opened ‘http:///webmail/src/configtest.php’ in my web browser. And what i see was php code of configtest.php. Looks like php didn’t work for this folder.

PHP works for /home//public_html folders but i don’t know what, it doesn’t for /usr/share/squirrelmail/ folder.

Can you please help me?


Yeah, life tends to be simplest when installing Squirrelmail into a specific Virtual Server. So, rather than using that RPM to install it, I’d suggest downloading the PHP code from the Squirrelmail site, and installing it into a particular Virtual Server.

You can always setup for all your Virtual Servers forward to this particular URL… you can set that in System Settings -> Server Templates -> Apache Website.


First thank you! :slight_smile: But I have virtualmin installed on another server and it has php scripts running in /usr/share/ quite OK (like phpmyadmin and again squirrelmail). All night long I compared the apache and php configurations but couldn’t find the difference causing this issue.

Isn’t there any workaround for this instead of installing them in a seperate virtual server created in virtualmin?

I’m also having this issue on a single server (fresh install). Squirrelmail was made to run from an Alias so that you can run it from many domains without having to install it more than once. I have other servers that run it as an Alias just fine, but not from this one. Running the config test just dumps a bunch of code on the screen and there are no errors in the log files. I can’t even run a simple php test script for the Alias directory.

Ok I think I got it solved. This may not be the best solution in the world, but it was the reason it worked on my other servers. It seems virtualmin started using mod_fcgid by default in their new installations. I disabled mod_fcgid and things started to work normally again. To disable this properly on CentOS you must move fcgid.conf from /etc/httpd/conf.d/ to another directory (like /root or something just to keep it out of the way and then comment out the following options from each virtualhost directive that has them (except in the /dav directives)

AddHandler fcgid-script .php

AddHandler fcgid-script .php5

FCGIWrapper /home/virtualserver/fcgi-bin/php5.fcgi .php

FCGIWrapper /home/virtualserver/fcgi-bin/php5.fcgi .php5

RemoveHandler .php

RemoveHandler .php5

IPCCommTimeout 31

Then to ensure this doesn’t get added for future virtual servers you must change mod_fcgid to mod_php in the default virtual server template which can be found in

Virtualmin > System Settings > Server Templates

Select Default Settings

Then in the drop down menu, scroll down to Apache Website

A little over halfway down you’ll see: Default PHP execution mode. Change that to mod_php and save your settings. These will also take affect for the subdomain template by default so you don’t have to worry about changing it there.

test your config on apache with /etc/init.d/httpd configtest and if it passes then just restart it. If it doesn’t pass that means you missed a line that needed to be commented out.

Hopefully this helps out others, I’ve been banging my head about this all day. If someone can present a better solution that doesn’t require disabling mod_fcgid that also allows us to use Alias directives please fill me in.