Ubuntu – Webmin / Virtualmin running php as www-data, is locked out of viewing .htaccess and writing

apache-2.2Ubuntuwww-data

I've asked this on the virtualmin forums, but haven't had any help from there.

Recently, "something" happened and it seems that the apache service has gone a bit weird.

What it does: it runs all apache traffic as www-data and sometimes spawns the php5-cgi process as www-data, this is a problem because all the domain users own their directories and default permissions don't let www-data write to these folders (file uploads are dead) or read .htaccess (permalinks are broken in wordpress).

I've googled this for about a week straight now, tried pretty much everything I could find and achieved nothing.

The only thing that I think might actually be the cause of all this is this page: http:// – i.imgur.com/NYW3x.png (got shut down by the spam filter) So I figured if I set it to "default", this might magically start working again, but all it does is "crash" apache (all websites timeout).

I figure it's something to do with the "mpm" module or something, but I can't find anything relevant in the settings to modify for it to work.

Can someone please point me in the right direction?

System info:

Webmin version   1.580
Kernel and CPU    Linux 2.6.35.4-rscloud on x86_64
Virtualmin version 3.90.gpl GPL
Ubuntu 10.04 LTS (Lucid)

A couple screenshots of top

Best Answer

When updating to php 5.4+ on a Debian server I ran into this same problem.

By default, the php5.4+ distribution will include the SetHandler directive in its apache conf files. Virtualmin adds its own SetHandler configuration directive for each site. So to make this work properly you want to disable this directive from the default php conf file.

Open your php.conf or php5.conf apache conf files.

/etc/apache2/mods-available/php5.conf
/etc/apache2/mods-available/php_cgi5.conf

Comment out SetHandler lines with a #. Or the whole FilesMatch node.

#<FilesMatch ".+\.ph(p[345]?|t|tml)$">
#    SetHandler application/x-httpd-php
#</FilesMatch>

Restart apache.

Related Topic