cancel
Showing results for 
Search instead for 
Did you mean: 

Moving Magento 1.7 from one server to another > Error 500 when reload a page

Moving Magento 1.7 from one server to another > Error 500 when reload a page

Hello,

 

I am trying to move a magento community-edition plateform from a domain to another (in a sub folder). To do that, i referred to this tutorial: http://www.templatemonster.com/help/magento-how-to-move-your-website-from-one-domain-to-another.html

 

I think i succeed to change url modifications and database connexions because the first time i try to go the le site, the homepage worked well.

 

Unfortunately, then i notice when i reload this homepage i get an 500 error: Internal Server Error...

First i thought about a permission error. So i double checked the permission and i tried the magento-cleanup.php script: http://www.magentocommerce.com/wiki/groups/227/resetting_file_permissions

I think it reset well file permissions because just after this script finished, i was able to go to the home again. But on reload the same error come back and i have to redo the process (error > script > work > reload > error).

 

To sum up can go to a page but i am not able to navigate through the site. So i can go into the admin.

For information, i have configure memory_limit to 128M. I moved to gandi simple hosting.

I remove my .htaccess to put the default magento 1.7 one.

I adjust files and folders permission.

 

find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
chmod -R 777 media var app/etc

 

Could it be a miss configuration in the database which break the permissions after the first load?

Could it be a problem with foreign keys in the database (i remember i remove foreign keys to import into my new database)?

 

Any advice will be welcomed.

Thank you in advance.

jN

 

14 REPLIES 14

Re: Moving Magento 1.7 from one server to another > Error 500 when reload a page

Hi tomiotee 

 

Welcome to the forum.

 

An error 50x is a result of the server encontering an error while running your script, so if you are running on a pretty standard setup, you should be able to find the error in either apaches or PHP's error log. Depending on what server setup your have these might be located in different places. If you can't figure out where your error log is located your hosting provider should be able to help you there.

 

In the error log you should find a description for what is going wrong.

 

I hope this helps :-)

Re: Moving Magento 1.7 from one server to another > Error 500 when reload a page

Did you clear the Magento cache and sessions?

cd var/cache; rm -rf *

cd var/sessions; rm -f *

 

This can sometimes cause problems if you copied over old cache/session files. Also look in var/log/system.log, and the web server error log for your domain. This may help shed some light on the error.

 

Rob

LexiConn

 

Re: Moving Magento 1.7 from one server to another > Error 500 when reload a page

Thank you Theis Corfixen for your reply.

 

I check the error log and i get:

[Sun Mar 22 19:16:43.934821 2015] [:error] [...] (104)Connection reset by peer: [...] FastCGI: failed to read from backend server

 

So i will check into this direction before other investigation.

Re: Moving Magento 1.7 from one server to another > Error 500 when reload a page

robfico, thank you for your answer.

 

Yes, i clear the magento cache but it does not change anything.

 

About var/log/system.log, i get as the last error:

2015-03-02T05:33:49+00:00 ERR (3): Notice: Undefined index: data  in /srv/data/web/vhosts/.../lib/Zend/Cache/Backend/TwoLevels.php on line 250

 

I am not sure these is involed into my 500 errors.

Re: Moving Magento 1.7 from one server to another > Error 500 when reload a page

Hi tomiotee

 

This sounds like something is wrong in the config, between Apache and PHP, possibly the setting FastCGIExternalServer, it might be pointing at the wrong socket, or no socket have been set by PHP. 

 

Re: Moving Magento 1.7 from one server to another > Error 500 when reload a page

you need to check your error log at the time you get the error.
and i mean php error log.

and then you will see whats going on.

------------
MagenX - Magento and Server optimization

Re: Moving Magento 1.7 from one server to another > Error 500 when reload a page

Hello,

 

So i check the php errors, the only on i see after a cycle (magento-cleanup > homepage > ok > homepage reloaded > ko) is:

[23-Mar-2015 06:11:33 Europe/Berlin] PHP Warning: chmod(): No such file or directory in /srv/data/web/vhosts/dev.tomiotee.com/htdocs/tomiotee/v1/magento-cleanup.php on line 45

 

So it's only concerne the magento-cleanup file and none error from magento.

 

For information, the magento-cleanup code:

<?php

## Function to set file permissions to 0644 and folder permissions to 0755

function AllDirChmod( $dir = "./", $dirModes = 0755, $fileModes = 0644 ){
   $d = new RecursiveDirectoryIterator( $dir );
   foreach( new RecursiveIteratorIterator( $d, 1 ) as $path ){
      if( $path->isDir() ) chmod( $path, $dirModes );
      else if( is_file( $path ) ) chmod( $path, $fileModes );
  }
}

## Function to clean out the contents of specified directory

function cleandir($dir) {

    if ($handle = opendir($dir)) {
        while (false !== ($file = readdir($handle))) {
            if ($file != '.' && $file != '..' && is_file($dir.'/'.$file)) {
                if (unlink($dir.'/'.$file)) { }
                else { echo $dir . '/' . $file . ' (file) NOT deleted!<br />'; }
            }
            else if ($file != '.' && $file != '..' && is_dir($dir.'/'.$file)) {
                cleandir($dir.'/'.$file);
                if (rmdir($dir.'/'.$file)) { }
                else { echo $dir . '/' . $file . ' (directory) NOT deleted!<br />'; }
            }
        }
        closedir($handle);
    }

}

function isDirEmpty($dir){
     return (($files = @scandir($dir)) && count($files) <= 2);
}

echo "----------------------- CLEANUP START -------------------------<br/>";
$start = (float) array_sum(explode(' ',microtime()));
echo "<br/>*************** SETTING PERMISSIONS ***************<br/>";
echo "Setting all folder permissions to 755<br/>";
echo "Setting all file permissions to 644<br/>";
AllDirChmod( "." );
echo "Setting pear permissions to 550<br/>";
chmod("pear", 550);

echo "<br/>****************** CLEARING CACHE ******************<br/>";

if (file_exists("var/cache")) {
    echo "Clearing var/cache<br/>";
    cleandir("var/cache");
}

if (file_exists("var/session")) {
    echo "Clearing var/session<br/>";
    cleandir("var/session");
}

if (file_exists("var/minifycache")) {
    echo "Clearing var/minifycache<br/>";
    cleandir("var/minifycache");
}

if (file_exists("downloader/pearlib/cache")) {
    echo "Clearing downloader/pearlib/cache<br/>";
    cleandir("downloader/pearlib/cache");
}

if (file_exists("downloader/pearlib/download")) {
    echo "Clearing downloader/pearlib/download<br/>";
    cleandir("downloader/pearlib/download");
}

if (file_exists("downloader/pearlib/pear.ini")) {
    echo "Removing downloader/pearlib/pear.ini<br/>";
    unlink ("downloader/pearlib/pear.ini");
}

echo "<br/>************** CHECKING FOR EXTENSIONS ***********<br/>";
If (!isDirEmpty("app/code/local/")) { 
    echo "-= WARNING =- Overrides or extensions exist in the app/code/local folder<br/>";
}
If (!isDirEmpty("app/code/community/")) { 
    echo "-= WARNING =- Overrides or extensions exist in the app/code/community folder<br/>";
}
$end = (float) array_sum(explode(' ',microtime()));
echo "<br/>------------------- CLEANUP COMPLETED in:". sprintf("%.4f", ($end-$start))." seconds ------------------<br/>";
?>

 

I'm not sure this is in relation with my problem.

I'm still investigating.

 

[edit]

I find this page on gandi's wiki... where no solution is explain:

http://wiki.gandi.net/en/simple/errors/failed_to_read_from_backend

 

Thank you for the advices.

Re: Moving Magento 1.7 from one server to another > Error 500 when reload a page

Re: Moving Magento 1.7 from one server to another > Error 500 when reload a page

Make sure about the server resources, 500 internal server error generally an issue from server side. Still if all is ok (considering you have configured the magento website perfectly) please check your .htaccess file as well. 

We had the same issue on one of our customer's website and the reason was the resources of the server. 

 

Was my answer helpful? You can accept it as a solution.
175+ Professional Extensions for M1 & M2
Need a developer?Just visit Contact Us Now