Php – HTTP Post randomly cut (begins with PhpMyAdmin thesterious error)

apache-2.4PHPphp5phpmyadmin

This is the strangest error I have ever seen.

I have a problem with PhpMyAdmin. When I tried to export the database, I got an HTML file with an error message instead an SQL file. The message is:

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; 

Notice in ./export.php#225
 Undefined index: output_format

Backtrace

Notice in ./export.php#239
 Undefined index: compression

Backtrace

Notice in ./export.php#340
 Undefined variable: filename_template

Backtrace

Notice in ./export.php#416
 Undefined index: sql_structure_or_data

Backtrace

Notice in ./libraries/export.lib.php#613
 Undefined index: sql_structure_or_data

After that I increased max_input_vars to 10,000, and later to 100,000; I increased the memory_limit to 512M, the max_upload_size to 100M, etc., etc.

To debug the problem, I replaced PhpMyAdmin's export.php with the simple:

<php
   echo file_get_contents("php://input");

I noticed the POST is really truncated, but I cannot see any reason why or how.

"POST /pma/export.php HTTP/1.1" 200 1795 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0"
"POST /pma/export.php HTTP/1.1" 200 1795 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0"
"POST /pma/export.php HTTP/1.1" 200 6032 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0"
"POST /pma/export.php HTTP/1.1" 200 382 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0"
"POST /pma/export.php HTTP/1.1" 200 1795 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0"
"POST /pma/export.php HTTP/1.1" 200 4620 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0"
"POST /pma/export.php HTTP/1.1" 200 1795 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0"
"POST /pma/export.php HTTP/1.1" 200 1795 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0"
"POST /pma/export.php HTTP/1.1" 200 8402 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:51.0) Gecko/20100101 Firefox/51.0"

Apache2 security module is disabled

I do not use suoshin.

All limitations were checked with phpmyinfo, and all limits are far above what is reasonable.

After some refreshing (press F5, confirm resend), I noticed that the truncated size often changes: sometimes more, sometimes less. The passed post size is varying, and does not depend on anything. I restarted the server.

PHP version is: 5.6.30-0+deb8u1

Loaded apache2 modules:

core mod_so mod_watchdog http_core mod_log_config mod_logio mod_version mod_unixd mod_access_compat mod_alias mod_auth_basic mod_authn_core mod_authn_file mod_authz_core mod_authz_host mod_authz_user mod_autoindex mod_cgi mod_deflate mod_dir mod_env mod_filter mod_mime prefork mod_negotiation mod_perl sapi_apache2 mod_reqtimeout mod_rewrite mod_setenvif mod_status

Apache2 version: Apache/2.4.10 (Debian)

The system is up to date, the PhpMyAdmin also up to date (freshly downloaded from the official website). The server has plenty of free memory, and no memory error. There are no other errors. The only thing is that a "big" post request is not working well. The error logs do not contain any relevant information.

See also a video on this error: YouTube: HTTP POST randomly cutted

Best Answer

I had the exact same problem.

You could see at the first notice there is a problem with output_format, So somehow the chosen output format didn't get into the array.

I played around with it checking the View output as text radio button and then checking back the Save output to a file button and after doing that and pushing the go button it exported it well.

Related Topic