I have a fresh VPS with Ubuntu 12.04, on which I installed Virtualmin (with the install script).
I also have upgrading Ubuntu source repositories, to install php 5.4.11.
I have re-check webmin configuration and everything is fine.
When I try to access to a page, on a virtual server configurer with cgi or fcgi, my browser ask me to download the php file (even after clearing my browser’s cache).
It only works with mod_php.
I have read that thread : http://www.virtualmin.com/node/21082, but it didn’t help much.
What should I check / change, to make it work with fcgi mode ?
So just to verify, are you saying that you commented out the SetHandler lines mentioned in that other post?
That’s usually the cause of what you’re seeing.
Also, if you go into System Settings -> Re-Check Config, does it notice any problems?
They were not commented, after upgrading to php 5.4.x I guess.
But I got the warning when I re-checked the config, so I commented those lines.
No more problems are shown by the “Re-Check Config”.
After digging a bit more I found the problem :
at the end of my vhost.conf files, there was the following lines :
php_admin_value engine Off
Once I removed them, it starts working properly.
Hmm, that’s actually not a good thing… that means that something is forcing mod_php mode, which is a security concern.
If your domains are set to use CGI or FCGID, then you should be able to keep “php_admin_value engine Off” in your Apache config.
ah ! Too bad, I thought I had found the problem !
Do you have any suggestion of what could force “mod_php” ?
As I am the only one to have access to this server, is that a security issue that I should really care about ?
Some update !
I have compared Apache modules between my old and my new VPS.
The only difference was the new module php5_cgi, so I disabled it and put back “php_admin_value engine Off” in my vhost config.
And it works !
Maybe something is missing in my config to make php5_cgi to work, but I dont’t think I need it.
For those stil using .php3 filenames, you should modify the apache2 domainname.conf file. (/etc/apache2/sites-available/ for ubuntu 12.04)
whithout this, pages are loaded as files in the browser.
like this :
AddHandler fcgid-script .php
AddHandler fcgid-script .php3
AddHandler fcgid-script .php5
FCGIWrapper /home/opalesurfcasting/fcgi-bin/php5.fcgi .php
FCGIWrapper /home/opalesurfcasting/fcgi-bin/php5.fcgi .php3
FCGIWrapper /home/opalesurfcasting/fcgi-bin/php5.fcgi .php5
and this :
I was researching and investigating for hours and was about to do a major rollback when I found your post.
On Ubuntu 10.04 I had updated PHP to 5.4.13 and then experienced the very same symptoms that you’ve described.
Disabling php5_cgi finally did the trick!
Actually php5_cgi.conf also includes that
SetHandler application/x-httpd-php line which needs to be commented out.
Obviously the new php install had enabled this module by default.
It seems that after an update, i had the same issue. Are you guys planing on a fix for this issue?
How did you disable php5_cgi?
You have to go on Webmin page, then Servers -> Apache Webserver.
Click on “Global Configuration” tab, and choose “Configure Apache Modules”.
On that page just uncheck the module and save.
Yeah, that option may not exist in Webmin on CentOS… but that just means you’d need to manually edit your Apache config, and comment out the line that’s loading the module you no longer want.
Thx, I have no “config apache modules” option on the global config screen as per screenshot. Would you know where this is?
I just like to add something for those that are experiencing the same thing.
I have upgraded to PHP 5.4 and MySQL 5.5 on my CentOS 6.4 (I know this isn’t recommended but I needed to test if MySQL 5.5 had performance advantage over 5.1)
After that php files started to download on the browser instead of executing.
In my case this was fixed by editing this file
I changed this line:
Then restart Apache.
Also, isn’t “Configure Apache Modules” similar to “Re-configure Known Modules”?
If so, you can click “Module Config” on Apache page then set Always detect Apache modules automatically? to “No” so that the extra option appears.
Thanks for your post. It addressed my symptoms and was the easiest solution offered.
The solution that worked for me was to edit /etc/httpd/conf.d/php.conf
and replace these three lines:
AddHandler php5-script .php
More info: http://ilovevirtualmin.com/tag/virtualmin-upgrade-php-5-3-to-php-5-4/
The “Servers -> Apache Webserver” – Click on “Global Configuration” – “Configure Apache Modules”. – uncheck the module and save. (rebooted, just in case) solved my problem trying to install Drupal 8 (beta4). Now the server executes the php files instead of trying to download them.
Ubuntu Linux 12.04.4 (64 bits) (virtual machine)
Virtualmin 4.12.gpl GPL
Gustavo (Posting from Madrid)
PS. I had to install as well the gd extension, but that’s another tale.
This did it to me too.
I had upgraded my system according to debian squeezy to wheezy guide on virtualmin pages, i guess the mod got enabled by default at some point.
Well, that was one 10 hours well spent on figuring out what the heck is going on
From the last post… have solved my problem with change in php.conf from filesmatch… to addhandler…
I’m fear now with possible to someone download my php code.
There is anyway to block this download if something fail? That makes me to try abandon php. Hard security problem… SO HARD!