How I Debugged a phpMyAdmin 500 Error While Importing a Large SQL File on Laragon

php dev.to

I recently ran into a weird issue while working on a Laravel project on Windows using Laragon.

Everything was working fine until I tried to import a database through phpMyAdmin.

Instead of an SQL error, phpMyAdmin simply returned:

Internal Server Error
The server encountered an internal error or misconfiguration...
Enter fullscreen mode Exit fullscreen mode

No useful message. Just HTTP 500.

My SQL file was around 97 MB, so at first I thought it was probably a PHP upload limit issue.

It wasn't that simple.

Here is how I debugged it.

1. Check which PHP configuration is actually running

From Laragon Terminal:

php --ini
Enter fullscreen mode Exit fullscreen mode

Then I checked the important error settings:

php.exe -r "echo 'error_log=' . ini_get('error_log') . PHP_EOL;"
php.exe -r "echo 'log_errors=' . ini_get('log_errors') . PHP_EOL;"
php.exe -r "echo 'display_errors=' . ini_get('display_errors') . PHP_EOL;"
Enter fullscreen mode Exit fullscreen mode

My output was:

error_log=D:/C-data/laragon/tmp/php_errors.log
log_errors=1
display_errors=1
Enter fullscreen mode Exit fullscreen mode

One small Laragon/Git Bash issue I also found was:

type php
Enter fullscreen mode Exit fullscreen mode

returned:

php is aliased to `winpty php.exe'
Enter fullscreen mode Exit fullscreen mode

Because of that, commands like:

php -i | grep ...
Enter fullscreen mode Exit fullscreen mode

sometimes returned:

stdout is not a tty
Enter fullscreen mode Exit fullscreen mode

Using php.exe directly avoids that problem.

2. Check the PHP error log

My PHP error log was:

D:/C-data/laragon/tmp/php_errors.log
Enter fullscreen mode Exit fullscreen mode

I reproduced the import error and checked it:

tail -n 50 /d/C-data/laragon/tmp/php_errors.log
Enter fullscreen mode Exit fullscreen mode

Nothing useful appeared.

That was an important clue.

3. Make sure browser PHP and CLI PHP use the same php.ini

I created a temporary file:

<?php phpinfo();
Enter fullscreen mode Exit fullscreen mode

Then opened it through the browser.

Important values were:

Server API: CGI/FastCGI
PHP Version: 8.4.4
Loaded Configuration File:
D:\C-data\laragon\bin\php\php-8.4.4-nts-Win32-vs17-x64\php.ini
Enter fullscreen mode Exit fullscreen mode

My PHP limits were already high enough:

upload_max_filesize = 512M
post_max_size = 512M
memory_limit = 512M
max_execution_time = 36000
Enter fullscreen mode Exit fullscreen mode

So the 97 MB SQL file should have been allowed by PHP.

4. Check Apache logs

I located the Apache error log with:

grep -Ri "ErrorLog" /d/C-data/laragon/etc/apache2 /d/C-data/laragon/bin/apache 2>/dev/null
Enter fullscreen mode Exit fullscreen mode

In my case:

D:/C-data/laragon/bin/apache/httpd-2.4.54-win64-VS16/logs/error.log
Enter fullscreen mode Exit fullscreen mode

Then:

tail -n 50 /d/C-data/laragon/bin/apache/httpd-2.4.54-win64-VS16/logs/error.log
Enter fullscreen mode Exit fullscreen mode

Still nothing useful.

So I checked the access log:

tail -n 30 /d/C-data/laragon/bin/apache/httpd-2.4.54-win64-VS16/logs/access.log
Enter fullscreen mode Exit fullscreen mode

And finally found:

POST /phpmyadmin/index.php?route=/import HTTP/1.1" 500 530
Enter fullscreen mode Exit fullscreen mode

So the failure was definitely happening during the phpMyAdmin import request.

5. Check Laragon's FastCGI request limit

Because Laragon was using mod_fcgid, I searched its config:

grep -RniE "Fcgid|Timeout|LogLevel" \
/d/C-data/laragon/etc/apache2 \
/d/C-data/laragon/bin/apache/httpd-2.4.54-win64-VS16/conf 2>/dev/null
Enter fullscreen mode Exit fullscreen mode

That led me to:

D:\C-data\laragon\etc\apache2\fcgid.conf
Enter fullscreen mode Exit fullscreen mode

Inside I found:

FcgidIOTimeout 36000
FcgidConnectTimeout 16
FcgidMaxRequestLen 81310720
Enter fullscreen mode Exit fullscreen mode

The important one was:

FcgidMaxRequestLen 81310720
Enter fullscreen mode Exit fullscreen mode

That is only around 77.5 MiB.

My SQL file was:

ls -lh "/c/Users/Asus/Downloads/shabujglobal-crm (1).sql"
Enter fullscreen mode Exit fullscreen mode

Output:

97M
Enter fullscreen mode Exit fullscreen mode

So PHP allowed 512M, but Apache FastCGI only allowed around 77.5 MiB.

That mismatch can cause the request to fail before phpMyAdmin can properly process the upload.

6. Increase FcgidMaxRequestLen

Open:

D:\C-data\laragon\etc\apache2\fcgid.conf
Enter fullscreen mode Exit fullscreen mode

Change:

FcgidMaxRequestLen 81310720
Enter fullscreen mode Exit fullscreen mode

to:

FcgidMaxRequestLen 536870912
Enter fullscreen mode Exit fullscreen mode

That gives FastCGI a 512 MiB request limit.

Then:

Save → Laragon → Restart All
Enter fullscreen mode Exit fullscreen mode

and retry the import.

7. If the next error is “Maximum execution time of 300 seconds exceeded”

After fixing the request-size limit, I hit another possible bottleneck:

Fatal error: Maximum execution time of 300 seconds exceeded
in DbiMysqli.php
Enter fullscreen mode Exit fullscreen mode

If you see this, do not edit DbiMysqli.php. That is only where the timeout becomes visible.

Instead, open:

D:\C-data\laragon\etc\apps\phpMyAdmin\config.inc.php
Enter fullscreen mode Exit fullscreen mode

and add:

$cfg['ExecTimeLimit'] = 0;
Enter fullscreen mode Exit fullscreen mode

If the file contains a closing ?>, add the line before it.

Then:

Save → Laragon → Restart All
Enter fullscreen mode Exit fullscreen mode

and retry the import.

Setting ExecTimeLimit to 0 removes phpMyAdmin's execution-time limit for operations such as large imports.

In my debugging session, this was the latest issue I reached. I had not yet fully confirmed the final import after changing this setting, so treat this as the next configuration to verify if your import dies exactly at 300 seconds.

The main lesson

When phpMyAdmin gives you a generic 500 Internal Server Error while importing a large SQL file on Laragon, don't only check:

upload_max_filesize
post_max_size
memory_limit
max_execution_time
Enter fullscreen mode Exit fullscreen mode

Also check these two layers:

FcgidMaxRequestLen
Enter fullscreen mode Exit fullscreen mode

and:

$cfg['ExecTimeLimit']
Enter fullscreen mode Exit fullscreen mode

In my case, the debugging path was basically:

97 MB SQL file
↓
PHP limits looked fine
↓
No useful PHP error log
↓
Apache access log confirmed /import returned 500
↓
FastCGI request limit was smaller than the SQL file
↓
After that, phpMyAdmin's 300-second execution limit became the next bottleneck
Enter fullscreen mode Exit fullscreen mode

That is the part that can easily be missed: PHP may allow a large upload while Apache/FastCGI or phpMyAdmin still blocks it for a completely different reason.

And if you create a temporary phpinfo() file while debugging, delete it afterward.

Source: dev.to

arrow_back Back to Tutorials