Setting up my new server was going so well with Virtualmin.
The sites were working fine and I'd modified /etc/php5/apache2/php.ini and all was good.
Today I enabled SSL on a couple of sites and set the IP-based virtual FTP on. The SSL seemed to work.
I then added lots of email addresses to a couple of sites.
Suddenly I get nasty issues.
The short of it is that the PHP API Server has changed from "Apache 2 handler" which I was perfectly happy with to "CGI/FastCGI" which is breaking all sorts of stuff. I have no idea how this happened.
I don't know what the PHPSuexec and the CGI/FastCGI stuff do but I don't want or need them.
Can you tell me how to get back to the 'standard' Apache 2 Handler for the "Server API" under PHP Info?
...and ideally tell me how to avoid falling into this trap again.
Hmm... that shouldn't change on it's own, in theory! :-)
You should be able to switch between FCGID, CGI, and mod_php by going into Server Configuration -> Website Options, and setting the "PHP script execution mode" option.
-Eric
A note about this: Should the Apache mod_php option not appear anymore in the script execution modes list (happened to me a few times during my experiments), that might be due to a disabled PHP 5 mod in Apache, which can be remedied using:
Thanks for the quick replies. I really appreciate the support.
Locutus: As I know I want php5 (and appear to already have it) I tried enabling that first. The restart yielded this:
This indicates that I never had php5 enabled as a module - not sure what is going on here since phpinfo reports version 5.3.2) so I guessed it cannot be the problem. I disabled the module again.
Eric: On the Website options the execution mode is set to FCGId. Both options say "run as virtual server owner" which I don't want (explanation below). No other option appears. So:
Changing "Run CGI scripts as domain owner" to "no" (cgi scripts would be OK but NOT the PHP) and gave me an error:
"Failed to save website options : The CGI wrapper option cannot be selected unless Run CGI scripts as domain owner is"
The same error occurs with either attempted execution mode setting.
Just changing the execution mode to "CGI Wrapper" did not make any difference to the problem. I put the option back again.
On to the backups... I'll post here as I discover more.
Some background: Two of the websites use a shared database via the Magento ecommerce system. They have an identical file set with appropriate parameters being set in the .htaccess file.
In order for Magento to work smoothly the public_html folder of one site is simply a link to the public_html folder on the other site. This works well when the apache user is www-data for both sites but falls in a heap if the sites were running scripts as the site owner. Workarounds for this are possible with groups etc. but I'd prefer to simply have it working the way it was.
The error message you posted sounds like the apache module for php 5 is actually missing... Question of course is how it got uninstalled. :) Or maybe just the module file was deleted.
Assuming you're using Ubuntu or Debian or another distro with the apt package manager, can you please post the output of
apt-show-versions | grep libapache2
Still assuming that you're using a distro with "apt", the following command reinstalls the apache php 5 package, reinstating the libphp5.so file if it got deleted:
apt-get install libapache2-mod-php5 --reinstall
Also, did you install Virtualmin using the automatic installer script? If so, the apache php 5 module would have been auto-installed.
I did auto install.
I've reinstalled php5 which is not installed - is it really needed if PHP is there?? the php was working fine on the site without it.
Now the sites are totally broken and PHP is not working at all!
To clarify 'broken' further the php extension is not being recognised so I get prompted to download the file on a browser.
When I restarted apache again, I got the mod_php execution mode option back again for executing php scripts. I'm very confused - why would the second restart make any difference?
I set the sites how they should be (Apache 2 handler and no running CGI scripts as the domain owner...
PHP reports the right thing. The sites work again - including the linked one.
I'm still confused but its all working again.
It seems php5 had gone missing.
Thanks for the help.
Thank you so much for this post! I want to report that I have experienced exactly the same problem as whippy. I use "Ubuntu" as well.
The solution given here worked for me too. It is really not normal that php5 disappeared this way. So there must have been some bug whether in Virtualmin or in Ubuntu coming from a recent "apt-get update".
Same here - after installing updates, apache refused to start - complaining of syntax errors in site config files -
Invalid command 'php_value', perhaps misspelled or defined by a module not included in the server configuration
after an apt-get update followed by apt-get install libapache2-mod-php5 --reinstall
apache now restarts and things 'look' like they are working again.