Loading...

Getting the 'MySQL server has gone away' error

We no longer maintain the Knowledge Base since version 4.3.x. All the latest user and developer documentation for 4.3.x and newer versions is now available at docs.cs-cart.com.

  • This article is available only for CS-Cart versions:
  • 1.3.5
If you get the "MySQL server has gone away" error while installing CS-Cart skins:

The problem may be caused by the fact that MySQL server dropped the connection after the short period of time. The error that caused this problem is MySQL server has gone away:
http://dev.mysql.com/doc/refman/5.0/en/gone-away.html

To solve this problem:
  1. Open the install.php file located in the core directory of your CS-Cart location.
  2. Replace there the following part of code:
    } else {
            // Install default blue scheme if the skin doesn't have the admin zone
            fn_install_skin(BASE_SKIN);
            db_query("UPDATE $db_tables[settings] SET value='" . BASE_SKIN . "' WHERE option_name='skin_name_admin'");
        }
    
        if (!empty($skin_data['partner']) && $skin_data['partner'] == 'Y') {
            if (fn_copy('var'.DS.'skins_repository'.DS.$skin_name.DS.'partner', 'skins'.DS.$skin_name.DS.'partner', false) == false) {
                die("<br /><b>ERROR</b> occurred while coping the files! Please check if the \"var/skins_repository/$skin_name/partner\" directory exists, has read permissions and the \"skins\" root directory has write permissions");
            }
        } else {
            // Install default blue scheme if the skin doesn't have the affiliate zone
            fn_install_skin(BASE_SKIN);
            db_query("UPDATE $db_tables[settings] SET value='" . BASE_SKIN . "' WHERE option_name='skin_name_partner'");
        }

    with this one:
    } else {
            // Install default blue scheme if the skin doesn't have the admin zone
            fn_install_skin(BASE_SKIN);
            //db_query("UPDATE $db_tables[settings] SET value='" . BASE_SKIN . "' WHERE option_name='skin_name_admin'");
        }
    
        if (!empty($skin_data['partner']) && $skin_data['partner'] == 'Y') {
            if (fn_copy('var'.DS.'skins_repository'.DS.$skin_name.DS.'partner', 'skins'.DS.$skin_name.DS.'partner', false) == false) {
                die("<br /><b>ERROR</b> occurred while coping the files! Please check if the \"var/skins_repository/$skin_name/partner\" directory exists, has read permissions and the \"skins\" root directory has write permissions");
            }
        } else {
            // Install default blue scheme if the skin doesn't have the affiliate zone
            fn_install_skin(BASE_SKIN);
            //db_query("UPDATE $db_tables[settings] SET value='" . BASE_SKIN . "' WHERE option_name='skin_name_partner'");
        }
  3. Replace the following part of code:
    if ($mode == 'install_skin') {
        db_initiate($db_host, $db_user, $db_password, $db_name);
        $skin_name = db_get_field("SELECT value FROM $db_tables[settings] WHERE option_name='skin_name_customer'");
    
        fn_start_scroller_i();
    
        fn_install_skin($skin_name);

    with this one:
    if ($mode == 'install_skin') {
        db_initiate($db_host, $db_user, $db_password, $db_name);
        $skin_name = db_get_field("SELECT value FROM $db_tables[settings] WHERE option_name='skin_name_customer'");
            db_query("UPDATE $db_tables[settings] SET value='" . BASE_SKIN . "' WHERE option_name='skin_name_admin'");
            db_query("UPDATE $db_tables[settings] SET value='" . BASE_SKIN . "' WHERE option_name='skin_name_partner'");
        fn_start_scroller_i();
    
        fn_install_skin($skin_name);
  4. Save the file.
  5. Execute the install.php file again.
    NOTE: If you are asked for Authentication code, you can find it at the very end of the config.php file located in the root directory of your CS-Cart installation.
Home / Knowledge base / Installation / Getting the 'MySQL server has gone away' error