When phpMyAdmin export is not working, it is usually caused by:
- PHP limits (memory, execution time, post size)
- Database issues (corrupt tables, large datasets)
- Server misconfiguration (Apache/Nginx settings, missing extensions)
- Permission problems
This guide covers how a server administrator can systematically diagnose and resolve this issue.
Identify the Error
Before applying a fix, identify why the export is failing.
Check phpMyAdmin Errors
- Open phpMyAdmin
- Try exporting a small table first.
- If a blank page appears or a timeout occurs, check the logs.
Inspect Browser Console (F12)
- Open Developer Tools (F12 or Ctrl + Shift + I in Chrome).
- Go to the Console tab.
- Look for errors related to timeouts, JavaScript failures, or CORS issues.
Check Web Server Logs
tail -f /var/log/apache2/error.log
tail -f /var/log/nginx/error.log
Look for errors like:
PHP Fatal error: Allowed memory size exhausted
504 Gateway Timeout
MySQL server has gone away
Check phpMyAdmin Configuration Logs
tail -f /var/log/syslog | grep phpmyadmin
Once you have identified the issue, proceed to the relevant fix below.
Fix PHP Limitations
If the export fails due to timeout, memory, or upload size limits, increase PHP settings.
Edit php.ini
Find the php.ini file:
php --ini | grep "Loaded Configuration File"
Edit it:
sudo nano /etc/php/8.0/apache2/php.ini
Modify these values:
memory_limit = 512M
max_execution_time = 600
max_input_time = 600
post_max_size = 512M
upload_max_filesize = 512M
Explanation:
memory_limit > Prevents large exports from failing due to memory limits.
max_execution_time > Extends PHP script execution time.
max_input_time > Prevents premature termination.
post_max_size & upload_max_filesize > Ensures large exports/imports work.
Restart Apache/Nginx:
sudo systemctl restart apache2
sudo systemctl restart nginx php8.0-fpm
Fix MySQL Configuration
Increase MySQL Timeout Values
Edit MySQL configuration:
sudo nano /etc/mysql/my.cnf
Add or modify:
[mysqld]
max_allowed_packet=512M
net_read_timeout=600
net_write_timeout=600
wait_timeout=600
interactive_timeout=600
Restart MySQL:
sudo systemctl restart mysql
Check for Corrupt Tables
If export fails only for certain tables, run:
mysqlcheck -u root -p --all-databases
To repair:
mysqlcheck -u root -p --repair --all-databases
Fix Web Server (Apache/Nginx) Issues
Increase Apache/Nginx Timeout
For Apache
Edit:
sudo nano /etc/apache2/apache2.conf
Add or modify:
Timeout 600
ProxyTimeout 600
Restart Apache:
sudo systemctl restart apache2
For Nginx
Edit:
sudo nano /etc/nginx/nginx.conf
Add or modify:
fastcgi_read_timeout 600;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
Restart Nginx:
sudo systemctl restart nginx
Check File Permissions
If phpMyAdmin cannot write the export file, check file permissions:
sudo chown -R www-data:www-data /var/lib/phpmyadmin/tmp/
sudo chmod -R 755 /var/lib/phpmyadmin/tmp/
This ensures phpMyAdmin can temporarily store exported files.
Use mysqldump as an Alternative
If phpMyAdmin still fails, use mysqldump:
mysqldump -u root -p database_name > /backup/database.sql
For large databases:
mysqldump -u root -p --max_allowed_packet=512M --single-transaction database_name > /backup/database.sql
Summary of Fixes
| Issue |
Fix |
| Export fails due to timeout |
Increase max_execution_time in php.ini |
| Large database export fails |
Increase memory_limit, max_allowed_packet |
| MySQL crashes during export |
Increase wait_timeout, repair corrupt tables |
| Nginx/Apache timeout |
Increase timeout values |
| Permission errors |
Set correct permissions on /var/lib/phpmyadmin/tmp/ |
| Still not working? |
Use mysqldump |
By following these systematic troubleshooting steps, you can fix phpMyAdmin export issues and ensure smooth database backups.