On my server, I've been holding off on upgrading to Ubuntu 14.04 but yesterday a new video capture card forced my hand. So I upgraded to 14.04 from 12.04, and since then my php pages just spit out the source. I've been searching for a solution for 14+ hours and I'm hoping this is not so complicated as it appears. Nothing appears in any log file that I can find, and I've tried a simple web page called test.php which is nothing more than:
<?php
phpinfo();
?>
And this is the exact page source when viewed in a browser :-(
Is there some way to make apache2 output useful debug info? Maybe that is where I should focus my question. Thanks for your help!
Deron
The amount of configuration files involved seems enormous, but I'll take a swing at providing the relevant bits in hopes that someone can lead my down a more promising trail.
/etc/apache2/mods-available/php5.conf:
<FilesMatch ".+\.ph(p[345]?|t|tml)$"> SetHandler application/x-httpd-php </FilesMatch> <FilesMatch ".+\.phps$"> SetHandler application/x-httpd-php-source # Deny access to raw php sources by default # To re-enable it's recommended to enable access to the files # only in specific virtual host or directory Order Deny,Allow Deny from all </FilesMatch> # Deny access to files without filename (e.g. '.php') <FilesMatch "^\.ph(p[345]?|t|tml|ps)$"> Order Deny,Allow Deny from all </FilesMatch> # Running PHP scripts in user directories is disabled by default # # To re-enable PHP in user directories comment the following lines # (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it # prevents .htaccess files from disabling it. #<IfModule mod_userdir.c> # <Directory /home/*/public_html> # php_admin_flag engine Off # </Directory> #</IfModule>
/etc/apache2/sites-available/domain.tld.conf (I naively think that the problem is here)
<VirtualHost 88.99.111.77:80> SuexecUserGroup "#1026" "#1007" ServerName domain.tld ServerAlias www.domain.tld ServerAlias webmail.domain.tld ServerAlias admin.domain.tld DocumentRoot /home/domain.tld/public_html ErrorLog /var/log/virtualmin/domain.tld_error_log CustomLog /var/log/virtualmin/domain.tld_access_log combined ScriptAlias /cgi-bin/ /home/domain.tld/cgi-bin/ ScriptAlias /awstats/ /home/domain.tld/cgi-bin/ DirectoryIndex index.html index.htm index.php index.php4 index.php5 <Directory /home/domain.tld/public_html> Options -Indexes +IncludesNOEXEC +SymLinksifOwnerMatch +ExecCGI Require all granted AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch AddHandler fcgid-script .php AddHandler fcgid-script .php5 FcgidWrapper /home/domain.tld/fcgi-bin/php5.fcgi .php FcgidWrapper /home/domain.tld/fcgi-bin/php5.fcgi .php5 </Directory> <Directory /home/domain.tld/cgi-bin> Require all granted AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch </Directory> RewriteEngine on RewriteCond %{HTTP_HOST} =webmail.domain.tld RewriteRule ^(.*) https://domain.tld:20000/ [R] RewriteCond %{HTTP_HOST} =admin.domain.tld RewriteRule ^(.*) https://domain.tld:10000/ [R] IPCCommTimeout 9999 <Files awstats.pl> AuthName "domain.tld statistics" AuthType Basic AuthUserFile /home/domain.tld/.awstats-htpasswd require valid-user </Files> php_admin_value engine Off FcgidMaxRequestLen 1073741824 </VirtualHost> <VirtualHost 88.99.111.77:443> SuexecUserGroup "#1026" "#1007" ServerName domain.tld ServerAlias www.domain.tld ServerAlias webmail.domain.tld ServerAlias admin.domain.tld DocumentRoot /home/domain.tld/public_html ErrorLog /var/log/virtualmin/domain.tld_error_log CustomLog /var/log/virtualmin/domain.tld_access_log combined ScriptAlias /cgi-bin/ /home/domain.tld/cgi-bin/ ScriptAlias /awstats/ /home/domain.tld/cgi-bin/ DirectoryIndex index.html index.htm index.php index.php4 index.php5 <Directory /home/domain.tld/public_html> Options -Indexes +IncludesNOEXEC +SymLinksifOwnerMatch +ExecCGI Require all granted AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch AddHandler fcgid-script .php AddHandler fcgid-script .php5 FcgidWrapper /home/domain.tld/fcgi-bin/php5.fcgi .php FcgidWrapper /home/domain.tld/fcgi-bin/php5.fcgi .php5 </Directory> <Directory /home/domain.tld/cgi-bin> Require all granted AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch </Directory> RewriteEngine on RewriteCond %{HTTP_HOST} =webmail.domain.tld RewriteRule ^(.*) https://domain.tld:20000/ [R] RewriteCond %{HTTP_HOST} =admin.domain.tld RewriteRule ^(.*) https://domain.tld:10000/ [R] RemoveHandler .php RemoveHandler .php5 IPCCommTimeout 9999 SSLEngine on SSLCertificateFile /home/domain.tld/ssl.cert SSLCertificateKeyFile /home/domain.tld/ssl.key <Files awstats.pl> AuthName "domain.tld statistics" AuthType Basic AuthUserFile /home/domain.tld/.awstats-htpasswd require valid-user </Files> SSLCACertificateFile /home/domain.tld/ssl.ca php_admin_value engine Off FcgidMaxRequestLen 1073741824 </VirtualHost>
Running into the same problem here. PHP not parsing. Pretty overwhelming all the places to check. Any help appreciated.
Howdy,
You guys may want to try commenting out the "SetHandler" lines in the "/etc/apache2/mods-available/php5.conf" file, and then restart Apache with this command:
/etc/init.d/apache2 restart
After doing that, does PHP work properly?
-Eric
That was one of the first things I tried. The strange thing is PHP works for virtualmin, but why won't it work for individual sites? I notice each site has it's own php.ini. Could the problem reside there? It's unclear which files are involved here, there are so many.
This is a fresh install.
Comment / Delete the line
php_admin_value engine Off
from your domain.conf file and it should work.Question to Eric: I have been trying to get rid of this option from being set for sometime now. I don't know why VirtualMin is setting that config.
I am running apache2.4.7 virtualmin 4.11 on Ubuntu 14.04
If mod_php is enabled, Virtualmin sets that when either FCGID or CGI is being used for a given domain.
That prevents someone from being able to trick Apache into running PHP code under mod_php (which is insecure), rather than their own userid.
You're welcome to disable mod_php if you don't need it, once you do that, Virtualmin will stop adding those "php_admin_value" parameters.
-Eric
Hi Eric,
If I disable mod_php, then I cannot run PHP on my site. So it looks like a catch-22 situation. I need to enable mod_php to run PMA, but then Virtualmin locks me down.
How do I go about it?
Howdy,
You shouldn't actually need mod_php. It's just an optional module.
If removing that is causing PHP to not work, it sounds like you may be seeing a configuration problem of some sort.
We can dig into that more, though you may want to start a new Forum thread to look into that issue.
However, on my own servers, I disable mod_php, as doing so frees up a decent chunk of RAM.
-Eric