The ERR_INVALID_RESPONSE error in phpMyAdmin indicates that the server is not responding with a valid HTTP response. This usually happens due to:
- PHP misconfiguration (timeouts, memory limits, incorrect headers)
- Web server issues (Apache/Nginx configuration errors)
- MySQL connectivity issues (slow queries, server overload)
- Session or cookie corruption
- Firewall or security settings blocking the response
This guide provides step-by-step troubleshooting from a server administrator's perspective.
Identify the Cause of ERR_INVALID_RESPONSE
Check phpMyAdmin Logs
phpMyAdmin logs are stored in system logs. Check for errors:
sudo tail -f /var/log/syslog | grep phpmyadmin
sudo tail -f /var/log/apache2/error.log
sudo tail -f /var/log/nginx/error.log
Inspect Browser Console (F12 in Chrome)
- Open phpMyAdmin.
- Press F12 to open Developer Tools.
- Check the Console tab for errors like:
- Failed to load resource: ERR_INVALID_RESPONSE
- Unexpected token < in JSON
- 504 Gateway Timeout
Fix PHP Configuration
If the error is due to PHP settings (timeouts, memory issues), modify the php.ini file.
Locate the php.ini File
php --ini | grep "Loaded Configuration File"
Edit the file:
sudo nano /etc/php/8.0/apache2/php.ini
sudo nano /etc/php/8.0/fpm/php.ini
Increase PHP Limits
Modify these settings:
memory_limit = 512M
max_execution_time = 600
max_input_time = 600
post_max_size = 512M
upload_max_filesize = 512M
session.gc_maxlifetime = 3600
Explanation:
memory_limit > Prevents out-of-memory errors.
max_execution_time & max_input_time > Ensures long-running exports don't time out.
post_max_size & upload_max_filesize > Supports large database imports/exports.
session.gc_maxlifetime > Prevents session expiration issues.
Restart Web Server & PHP-FPM
For Apache:
sudo systemctl restart apache2
For Nginx:
sudo systemctl restart nginx php8.0-fpm
Fix Web Server Configuration
If phpMyAdmin is not responding properly, check Apache or Nginx settings.
Apache Configuration
Edit the config file:
sudo nano /etc/apache2/apache2.conf
Ensure these settings exist:
Timeout 600
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 60
Save and restart Apache:
sudo systemctl restart apache2
Nginx Configuration
Edit the Nginx site configuration:
sudo nano /etc/nginx/sites-available/default
Ensure these timeout settings:
fastcgi_read_timeout 600;
proxy_connect_timeout 600;
proxy_send_timeout 600;
proxy_read_timeout 600;
Restart Nginx:
sudo systemctl restart nginx
Fix MySQL Connection Issues
If phpMyAdmin fails to load databases, MySQL may be the problem.
Check MySQL Status
sudo systemctl status mysql
If MySQL is down, restart it:
sudo systemctl restart mysql
Increase MySQL Timeout
Edit MySQL configuration:
sudo nano /etc/mysql/my.cnf
Modify:
[mysqld]
wait_timeout=600
interactive_timeout=600
max_allowed_packet=512M
Restart MySQL:
sudo systemctl restart mysql
Check for Corrupt Tables
Run:
mysqlcheck -u root -p --all-databases
If errors appear, repair:
mysqlcheck -u root -p --repair --all-databases
Clear Sessions and Cache
If phpMyAdmin stuck or not responding, clearing sessions may help.
Clear PHP Sessions
Delete old session files:
rm -rf /var/lib/php/sessions/*
Clear Browser Cookies & Cache
- Open browser settings > Clear Cookies & Site Data.
- Restart browser and retry.
Check Security & Firewall Settings
If your firewall blocks PHP responses, allow it.
Check ModSecurity (for Apache)
If using ModSecurity, check logs:
sudo tail -f /var/log/apache2/modsec_audit.log
If ModSecurity blocks requests, disable it for phpMyAdmin:
sudo nano /etc/apache2/modsecurity.conf
Change:
SecRuleEngine Off
Restart Apache:
sudo systemctl restart apache2
Check Fail2Ban
If Fail2Ban blocks phpMyAdmin requests, unban your IP:
sudo fail2ban-client status
sudo fail2ban-client unban YOUR_IP
Use mysqldump Instead
If phpMyAdmin still fails, manually export databases:
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
For compressed export:
mysqldump -u root -p database_name | gzip > /backup/database.sql.gz
Summary
| Issue |
Fix |
| PHP limits causing timeouts |
Increase memory_limit, max_execution_time in php.ini |
| Web server timeout issues |
Increase Timeout in Apache/Nginx configs |
| MySQL connection dropping |
Increase wait_timeout, max_allowed_packet in MySQL |
| phpMyAdmin session issues |
Clear /var/lib/php/sessions/ and browser cache |
| Firewall or security blocks |
Disable ModSecurity, unban IP in Fail2Ban |
| Still failing? |
Use mysqldump for manual export |
By following these server-level fixes, a system administrator can resolve ERR_INVALID_RESPONSE in phpMyAdmin, ensuring smooth MySQL database management.
If issues persist, check logs and firewall rules for additional blocks.