Results 1 to 5 of 5
Like Tree1Likes
  • 1 Post By Jason

Thread: Error: Could not load database file mysql!

  1. #1
    New Registered User basic279's Avatar
    Join Date
    Aug 2012
    Posts
    11

    Default Error: Could not load database file mysql! 16 Aug 2012 @ 13.38

    Hello guys,
    I developed a website in OpenCart locally. Now, i have uploaded it to my web-hosting server. The front end of the e-shop loads properly but when i try to load backoffice or admin area, i am getting Error: Could not load database file mysql!

    What could be the possible reason? i asked some friend and he told me that this sort of errors are basically driver errors...have your say and please help me to solve this.
      Reply With Quote

  2. #2
    Administrator Frinkky's Avatar
    Join Date
    Dec 2008
    Posts
    1,817
    Blog Entries
    1

    Default 16 Aug 2012 @ 16.05

    Two threads on the OpenCart forum that could offer some insight:

    OpenCart Community • View topic - "Error: Could not load database file mysql!"
    OpenCart Community • View topic - Error: Could not load database file mysql!

    The two main suggestions are to a) check mysql.php permissions (755 or 775) and/or b) install a fresh copy of OpenCart on the server, create a backup of your local version and restore it to the remote version. You'll need to upload any mods/themes/custom files.
      Reply With Quote

  3. #3
    New Registered User basic279's Avatar
    Join Date
    Aug 2012
    Posts
    11

    Default 16 Aug 2012 @ 18.10

    Thanks Frinkky, for your comment.

    changing rights permission didnt help at all. i can only see the solution by installing a fresh copy of OpenCart.
      Reply With Quote

  4. #4
    Super Moderator Jason's Avatar
    Join Date
    Dec 2008
    Posts
    917

    Default 21 Aug 2012 @ 14.14

    So.. I downloaded the system and tracked where that error is occuring.

    Its happening in 'system/library/db.php' and is caused by a missing file.

    PHP Code:
    if (file_exists(DIR_DATABASE $driver '.php')) { 
    Tracking this back I looked for where the DIR_DATABASE constant is defined and found this.

    Code:
    define('DIR_DATABASE', DIR_SYSTEM . 'database/');
    Now.. I cannot find where DIR_SYSTEM is defined. I assume it is in your config file. Basically, I think you installed the open cart software on your computer and then didn't update the config file correctly for the new environment.

    Looking it up.

    Config files

    I suggest you open up the index.php file on your server and add the following line at the top.

    PHP Code:
    echo getcwd();exit; 
    View the site in your browser and you will then see the path on your server to your application.

    You then need to change all these variables so they have the correct path.

    quote
    // DIR
    define('DIR_APPLICATION', '/home/xxxx/public_html/shop/catalog/');
    define('DIR_SYSTEM', '/home/xxxx/public_html/shop/system/');
    define('DIR_DATABASE', '/home/xxxx/public_html/shop/system/database/');
    define('DIR_LANGUAGE', '/home/xxxx/public_html/shop/catalog/language/');
    define('DIR_TEMPLATE', '/home/xxxx/public_html/shop/catalog/view/theme/');
    define('DIR_CONFIG', '/home/xxxx/public_html/shop/system/config/');
    define('DIR_IMAGE', '/home/xxxx/public_html/shop/image/');
    define('DIR_CACHE', '/home/xxxx/public_html/shop/system/cache/');
    define('DIR_DOWNLOAD', '/home/xxxx/public_html/shop/download/');
    define('DIR_LOGS', '/home/xxxx/public_html/shop/system/logs/');
    Delete the line above from your index.php file and you should be up and running.

    I hope all that makes sense.
    Last edited by Jason; 22 Aug 2012 at @ 08.23.
    Frinkky likes this.
      Reply With Quote

  5. #5
    New Registered User basic279's Avatar
    Join Date
    Aug 2012
    Posts
    11

    Default 22 Aug 2012 @ 08.15

    Thanks Jason for your detailed reply. I did changes accordingly in the config files. But it didnt solve the issue. So at last, after spending many hours with this error I opted to install a fresh copy.
      Reply With Quote

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •