Articles in this section

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

Plesk for Windows Plesk for Linux kb: technical ABT: Group B

Applicable to:

  • Plesk for Linux
  • Plesk for Windows

Symptoms

When trying to upload a database in phpMyAdmin more than 500M, getting the error.

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

mceclip0.png


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


CONFIG_TEXT: localhost:8443/domains/databases/phpMyAdmini/export.php
The site cannot be reached
The webpage at https://localhost:8443/domains/databases/phpMyAdmini/export.php might be temporarily down or it may have moved permanantly to a new web address
Err_Invalid_response

The file %plesk_dir%admin\logs\php_error.log contains the following record at the same time:

CONFIG_TEXT: PHP Fatal error: Maximum execution time of 300 seconds exceeded in C:\Program Files (x86)\Plesk\admin\htdocs\domains\databases\phpMyAdmin\libraries\classes\Dbi\DbiMysqli.php

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:

mceclip1.png

If it does not fit some needs proceed with the following solutions.

Solution 1

Increase the 'ExecTimeLimit' value:

Linux:

  1. Login to the server over SSH
  2. Create the file config.inc.php.
    For Plesk Onyx and Plesk Obsidian below 18.0.30:

    # cp -p /usr/local/psa/admin/htdocs/domains/databases/phpMyAdmin/libraries/config.default.php /usr/local/psa/admin/htdocs/domains/databases/phpMyAdmin/config.inc.php

    For Plesk Obsidian 18.0.30 and above:

    # cp -p /usr/local/psa/phpMyAdmin/libraries/config.default.php /usr/local/psa/phpMyAdmin/config.inc.php

  3. Increase the value of $cfg['ExecTimeLimit'] in config.inc.php created on step 2:

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

  4. 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;

  5. Restart sw-cp-server:

    # service sw-cp-server restart

Note: if the issue still persist, the browser cache should be cleared.


Windows:

  1. Login to the server over RDP.
  2. Create the file config.inc.php
    For Plesk Onyx and Plesk Obsidian below 18.0.30:
    Copy the content of %plesk_dir%admin\htdocs\domains\databases\phpMyAdmin\libraries\config.default.php to %plesk_dir%admin\htdocs\domains\databases\phpMyAdmin\config.inc.php.

    For Plesk Obsidian 18.0.30 and above:
    Copy the content of %plesk_dir%phpmyadmin\libraries\config.default.php to %plesk_dir%phpmyadmin\config.inc.php.

  3. Increase the value of $cfg['ExecTimeLimit'] in config.inc.php created on step 2:

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

Solution 2

Upload the database via command prompt:

Linux:

  1. Login to the server over SSH.
  2. Upload the database dump to the server (any of the convenient ways).
  3. Restore the database:

    # MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -uadmin db_name < /path/to/database_dump


Windows:

  1. Login to the server over RDP.
  2. Upload the database dump to the server.
  3. Restore the database:

    C:\> "%plesk_dir%MySQL\bin\mysql.exe" -u DBUSER -p******** -P 3306 DATABASENAME < .\path\to\mysql_backup.sql

 

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.