After installing Virtualmin we found that .php files were not being run through fcgid and so are running as the apache user & group rather than the virtual server user & group that they should be. Interestingly .php5 files ARE being run by fcgid as expected. This is a straightforward install Ubuntu 10.04, run Install.sh & enjoy setup. What should be mentioned as well is that this is a migration from a CentOS 5 system where everything was working as expected.
Here are examples of the issue:
http://216.86.69.241/phpinfo.php
http://216.86.69.241/phpinfo.php5
As you can see they're being handled completely differently.
Here's the site configuration:
<VirtualHost 216.86.69.241:80>
SuexecUserGroup #1002 #1002
ServerName molybdenumdefault.com
ServerAlias www.molybdenumdefault.com
ServerAlias webmail.molybdenumdefault.com
ServerAlias admin.molybdenumdefault.com
DocumentRoot /home/molybdenumdefault/public_html
ErrorLog /var/log/virtualmin/molybdenumdefault.com_error_log
CustomLog /var/log/virtualmin/molybdenumdefault.com_access_log combined
ScriptAlias /cgi-bin/ /home/molybdenumdefault/cgi-bin/
ScriptAlias /awstats /home/molybdenumdefault/cgi-bin
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/molybdenumdefault/public_html>
Options -Indexes IncludesNOEXEC FollowSymLinks +ExecCGI
allow from all
AllowOverride All
AddHandler fcgid-script .php
AddHandler fcgid-script .php5
FCGIWrapper /home/molybdenumdefault/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/molybdenumdefault/fcgi-bin/php5.fcgi .php5
</Directory>
<Directory /home/molybdenumdefault/cgi-bin>
allow from all
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.molybdenumdefault.com
RewriteRule ^(.*) https://molybdenum.lhsr.provide.net:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.molybdenumdefault.com
RewriteRule ^(.*) https://molybdenum.lhsr.provide.net:10000/ [R]
<Files awstats.pl>
AuthName "molybdenumdefault.com statistics"
AuthType Basic
AuthUserFile /home/molybdenumdefault/.awstats-htpasswd
require valid-user
</Files>
RemoveHandler .php
RemoveHandler .php5
IPCCommTimeout 31
</VirtualHost>
This was all generated by Virtualmin (except for the Rewrite tweaks). Changing the PHP script execution mode to Apache mod_php and back in Virtualmin correctly removes and re-adds the Handler directives but .php continues to not work correctly. No errors appear in the suexec, apache, or site logs when executing scripts.
We're kinda stumped at this point. Any ideas what could be causing these symptoms?
Comments
Submitted by sunsetsystems on Tue, 11/30/2010 - 16:48 Pro Licensee Comment #1
Submitted by andreychek on Tue, 11/30/2010 - 17:31 Comment #3
Yeah, looking at your phpinfo() output, it looks like .php files are being processed by mod_php.
If you aren't using mod_php, you may want to disable it altogether. You can do that on the command line by running this command:
a2dismod php5
Submitted by Locutus on Wed, 12/01/2010 - 04:05 Comment #4
I recall an issue here with Apache's PHP config file, causing mod_php to override FCGId configuration for *.php files. Take a look at
/etc/apache2/mods-available/php5.conf
. Does it look like this for you?If so, try commenting out (add # at the beginning) the two lines with the
SetHandler
directives. The regexps there look like they only apply to *.php, *.php3, *.phps and some others, but not to *.php5, that might be the reason why you experienced your issue.If this was indeed the case, actually, the Vmin installer should have done this automatically meanwhile, since this issue has been reported a while back. Maybe the fix has not yet been included.
Submitted by sunsetsystems on Thu, 12/02/2010 - 10:06 Pro Licensee Comment #5
Disabling mod_php fixed the issue after removing the mod_php specific lines in a few user's apache config files. Those SetHandler directives are most likely the cause of the issue. Thank you andreychek and Locutus.
Submitted by andreychek on Thu, 12/02/2010 - 09:42 Comment #6
Glad to hear you got it working, thanks for the update!
Submitted by sunsetsystems on Thu, 12/02/2010 - 10:06 Pro Licensee Comment #7
Always appreciate you guys. Thanks again!
Submitted by Locutus on Thu, 12/02/2010 - 11:42 Comment #8
You're welcome! :)
Submitted by anrikun on Wed, 12/08/2010 - 08:50 Comment #9
Hello, I'm having the same problem:
when php_mod is enabled, it seems to override fcgid in some cases.
The problem is that completely disabling php_mod prevents phpmyadmin to run.
So I need the following:
virtual servers created through Virtualmin (in /homes/*) should use only fcgid
other virtual servers (in /var/www/,like phpmyadmin) should use mod_php
How to achieve that?
Submitted by andreychek on Wed, 12/08/2010 - 09:25 Comment #10
Howdy -- don't forget that the support area here is for Virtualmin Pro customers :-) You're more than welcome to ask any questions you have in the forums though.
However, my recommendation would be to follow the advice of "Locutus" in comment #4 above, by commenting out the lines beginning with "SetHandler" in /etc/apache2/mods-available/php5.conf, then restart Apache. That should prevent mod_php from overriding fcgid/cgi.
Submitted by Issues on Wed, 12/22/2010 - 12:06 Comment #11
Automatically closed -- issue fixed for 2 weeks with no activity.