Unable to upload database with phpMyAdmin: Script timeout passed or 504 Gateway Timeout is shown

Created:

2016-11-16 12:51:59 UTC

Modified:

2017-08-17 08:27:40 UTC

5

Was this article helpful?


Have more questions?

Submit a request

Unable to upload database with phpMyAdmin: Script timeout passed or 504 Gateway Timeout is shown

Applicable to:

  • Plesk 10.x for Linux
  • Plesk 11.x for Linux
  • Plesk 12.0 for Linux

Symptoms

When trying to upload database in phpMyAdmin more then 500Mb getting the error..

Script timeout passed, if you want to finish import, please resubmit same file and import will resume.

Or:

ERROR: Maximum execution time of 300 seconds exceeded (DBIMysqli.php:262)

Cause

The error occurs because of a huge file and the restoration process fails with timeout.

Resolution

Starting from Plesk 12.5 it is possible to import databases via Plesk. Browse to Home > Domains > example.com > Databases and use importing functionality:

db_import.png

If it does not help follow one of the solutions below.

Solution 1

Increase the 'ExecTimeLimit'  value:

Linux:

  1. Login to the server over SSH
  2. Create the file config.inc.php at /usr/local/psa/admin/htdocs/domains/databases/phpMyAdmin/libraries/

  3. Copy the content of /usr/local/psa/admin/htdocs/domains/databases/phpMyAdmin/libraries/config.default.php to config.inc.php

  4. Increase the value of $cfg['ExecTimeLimit'] in /usr/local/psa/admin/htdocs/domains/databases/phpMyAdmin/libraries/config.inc.php :

    CONFIG_TEXT: $cfg['ExecTimeLimit'] = 3600;

Also, increase the settings in /etc/sw-cp-server/config to avoid '504 Gateway Timeout' error:

CONFIG_TEXT: fastcgi_read_timeout 3600;
fastcgi_send_timeout 3600;

and restart Apache and Plesk services:

# service psa restart
# service httpd restart

Windows:

  1. Login to the server over SSH
  2. Create the file config.inc.php at %plesk_dir%admin\htdocs\domains\databases\phpMyAdmin\libraries\

  3. Copy the content of %plesk_dir%admin\htdocs\domains\databases\phpMyAdmin\libraries\config.default.php to config.inc.php .

  4. Increase the value of $cfg['ExecTimeLimit'] in %plesk_dir%admin\htdocs\domains\databases\phpMyAdmin\libraries\config.inc.php :

    CONFIG_TEXT: $cfg['ExecTimeLimit'] = 3600;

Solution 2

Upload the database via command prompt:

1. Upload the database dump to the server

2. Login to Plesk database

3. Restore the database:

C:\> mysql -u USERNAME -p******** DATABASENAME < mysql_backup.sql

Additional Information

Cannot edit config.inc.php: Can't open file for writing

Have more questions? Submit a request
Please sign in to leave a comment.