Migration to new server not going well


Im trying to migrate from a Debian 6 x86 to a Debian 7 x64 server and have followed the http://www.virtualmin.com/documentation/system/migrate link but after restoring the vm's the fcgid seems to be broken and causes Error 500's, I have discovered if I delete the etc/php5 folder and php.ini from the virtual server's home folder, change the server to use apache_mod, then change it back to fcgi it regenerates the php.ini file and all works perfectly but I don't really want to have to do that for every single website... is there a known fix for this or some suggestion?



Howdy -- we hadn't seen that particular issue before.

What error showed up in the Apache logs when you were receiving that 500 error?

The Apache logs are located in $HOME/logs/error_log.

the error was [Mon Sep 23 23:00:48 2013] [warn] [client] (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server [Mon Sep 23 23:00:48 2013] [error] [client] Premature end of script headers: index.php

Is that an issue you're currently seeing on any of your domains?

I'd be curious if you continue to see that same error after switching the domain to use "CGI" rather than FCGID. Sometimes CGI produces more informative error messages.

hmmm interesting if I use cgi I get the following

[Tue Sep 24 14:39:54 2013] [error] [client] PHP Warning: Module 'imagick' already loaded in Unknown on line 0 [Tue Sep 24 14:39:54 2013] [error] [client] malformed header from script. Bad header=
: php5.cgi

hmm that's supposed to be " Bad header=< b r / >: php5.cgi" btw, It filtered the br :)

it deff appears to be something with the php.ini file that's followed over from the old server... I can swap the good one for the bad one and then it breaks a site, and then I swap it back and it starts working again have attached both copies incase you can see anything obviosis?

Is there any way we can just regen all of the php.ini's to the copy on the new server? something that does it the same as when ones made?

After talking to Jamie about that -- it doesn't appear that there is an automated way to resolve that.

He did mention though that one way to force Virtualmin to regenerate a php.ini would be to delete $HOME/etc/php.ini, and $HOME/etc/php5/php.ini, and then change the PHP Execution Mode to CGI, then back to FCGID.

How many domains did you have on your system though?

60 or so :) yeah, doing that did make it work, tho doing that manuaully is going to take forever lol :)

Well I found the lines that break it, using a command you asked someone else to test in another thread PHPRC=/home/USERNAME/etc/php5 php -m

Fatal error: Directive 'allow_call_time_pass_reference' is no longer available in PHP in Unknown on line 0 Fatal error: Directive 'magic_quotes_gpc' is no longer available in PHP in Unknown on line 0 Fatal error: Directive 'register_long_arrays' is no longer available in PHP in Unknown on line 0

Getting rid of those 3 lines in that php.ini file makes the site work again... but again still take a really long time to do on 60 domains, and of course that then has the risk of all the new stuff this php version has that this really old config file doesn't have in it any more... still make more sense to generate a new one... just I wonder how :)

Ah, those errors indicate compatibility issues.

They normally show up in the Apache logs though, that's odd that they weren't showing up in this case.

Anyhow, rather than regenerating the php.ini file, it may be possible to simply set those particular options to "Off".

You could try that on one particular domain, editing the php.ini and setting those to off. If that resolves it, you could then use Virtualmin's command line to update all the php.ini files to set that to off.

You can see the options for that by running this command:

virtualmin modify-php-ini

yeah... comparing those php.ini's to the new ones created on a new virtualmin server there were just too many differences to be happy/... what ive done is use the below and used a new php.ini from a newly created site to copy into each one and change the 2 lines to match the correct path, sites are all now working beautifully

mv /home/$1/etc/php5/php.ini /home/$1/etc/php5/php.ini.broken.1
cp php.ini /home/$1/etc/php5/php.ini
sed -i 's,REPLACEME,'"$1"',' /home/$1/etc/php5/php.ini
chown $1 /home/$1/etc/php5/php.ini
chgrp $1 /home/$1/etc/php5/php.ini
chmod 755 /home/$1/etc/php5/php.ini

then just called it using sh updatephp.sh username