Virtualmin not setting up PHP correctly

After updating to the most recent version of Virtualmin, when I create new accounts, Virtualmin sets up their VirtualHost entries as follows:

  <Directory /home/username/public_html>
    Options -Indexes +IncludesNOEXEC +FollowSymLinks +ExecCGI
    allow from all
    AllowOverride All
    AddHandler fcgid-script .php
    FCGIWrapper /home/username/fcgi-bin/php.fcgi .php
  <Directory /home/username/cgi-bin>
    allow from all
  RemoveHandler .php

Now, not only is it specifically inserting AddHandler fcgid-script and FCGIWrapper... which I do not want because I am using mod_fastcgi instead of mod_fcgid, but it’s also setting up PHP in such a way that it will never work! It’s adding a RemoveHandler .php after setting up the handler for PHP!

Where is this behavior configured and how can I stop it? Better yet, how can I make Virtualmin not include any PHP commands at all in the VirtualHost section?


Mmm, is there a particular feature you’re trying to gain access to by using fastcgi? The fcgid module is a bit more popular and actively developed these days… it’s been a few years since fastcgi had a new stable release, I believe.

Out of the box, Virtualmin supports fcgid, cgi, and mod_php. However, in digging around, I’m not sure how you’d go about manually adding support for a different PHP execution type.

As far as the RemoveHandler statements go – those RemoveHandler lines are outside of the “Directory” block, so they don’t effect calls to .php files in your DocumentRoot. That is, they don’t break PHP at all, though that will assist in making sure no PHP scripts outside your DocumentRoot inadvertently get called.


I was unable to getfcgid to do what I needed it to when I tried to install it before. I forgot what specifically the problem was, but basically I have mod_fastcgi working perfectly without suexec and with a global shared apc cache… I may look into fcgid in the future but for now I want to stick with what I know is working.

Is there any way to stop Virtualmin from generating the PHP config lines in httpd.conf? Can I effectively tell Virtualmin that PHP is off completely? I have PHP set up properly outside all VirtualHost files and I don’t allow users to change PHP settings so as far as I’m concerned if Virtualmin doesn’t even think PHP is available, all the better.