phpMyAdmin Memory Limit Crashing on Big Tables? Here's the Fix

Database Errors Intermediate 👁 10 views 📅 Jun 23, 2026

When phpMyAdmin runs out of memory on a big table, you need to bump the PHP memory limit. Here's three ways to fix it.

1. Bump the PHP Memory Limit in Your phpMyAdmin Config

This is the most common fix and the one I always try first. Had a client last month whose entire print queue died because phpMyAdmin kept throwing a Fatal error: Allowed memory size of 134217728 bytes exhausted when they tried to view a table with 500,000 rows. The default PHP memory limit is 128MB. For a big table, that's way too low.

Open your phpMyAdmin folder, usually /usr/share/phpmyadmin or /var/www/html/phpmyadmin on a Linux server. Find the file called config.inc.php. If it doesn't exist, copy config.sample.inc.php and rename it. Then add this line at the bottom:

ini_set('memory_limit', '512M');

Save the file. Restart Apache or Nginx. If you're using cPanel or Plesk, the paths are different—check the file manager for phpMyAdmin config. I've seen this fix work 9 out of 10 times. If it still crashes, go higher: 1GB. But don't go crazy—your server only has so much RAM.

One thing people miss: this line must be inside <?php tags. If your file already has a closing ?>, add the line before that.

2. Increase the Memory Limit Globally in php.ini

Sometimes the phpMyAdmin config trick doesn't stick because the server's main PHP settings override it. I had a client on shared hosting where the host locked down the phpMyAdmin config. That's when you need to find and edit php.ini directly.

Run this command on your server to find which php.ini phpMyAdmin uses:

php -i | grep php.ini

Look for the Loaded Configuration File line. Open that file. Find memory_limit. Change it from something like 128M to 512M.

memory_limit = 512M

Save and restart your web server. On cPanel servers, you can also use the MultiPHP INI Editor in the cPanel interface—just select phpMyAdmin's PHP version and change the memory limit there.

A warning: if you're on a cheap shared host, they might not let you edit php.ini at all. In that case, try method 3 or talk to your host.

3. Use a Custom .user.ini File for phpMyAdmin

Some hosting setups use .user.ini files that override the main php.ini. If the first two methods didn't work, this usually does. In the phpMyAdmin directory, create a file named .user.ini (note the dot at the start) and add this:

memory_limit = 512M

This method works on most modern PHP-FPM setups. I used it last week for a client whose WordPress database had a 2 million row table—worked like a charm.

One catch: some hosts block .user.ini files in certain directories. Check your host's docs. If they don't support it, you're stuck with method 1 or 2, or you need to use the command-line MySQL client instead.

Quick-Reference Summary Table

MethodWhat to DoWhen to Use
1. phpMyAdmin configAdd ini_set('memory_limit','512M') to config.inc.phpMost common fix, works on most servers
2. Main php.iniChange memory_limit valueWhen method 1 is ignored or overridden
3. .user.iniCreate file with memory_limit=512MOn PHP-FPM setups where methods 1 & 2 fail

One More Tip: Try the Command Line Instead

If none of these work, or if you're in a hurry, stop banging your head against phpMyAdmin. Open a terminal and use mysql directly. For example:

mysql -u yourusername -p yourdatabase -e "SELECT * FROM big_table LIMIT 1000;"

This bypasses PHP's memory limit entirely. It's not as pretty, but it gets the job done. I've saved hours this way on servers where the host refused to increase limits.

That's it. Three fixes, one quick table, and a backup plan. Go fix that error.

Was this solution helpful?