问题
I am sending data to PHP through HTTP POST. This works fine for data shorter than 8MB (8192KB), however when higher quantities of data are sent, PHP shows the $_POST variable to be empty. I emphasize that the $_POST variable does not even contain the names of the post fields, it exists as an empty array. The critical point seems to be between 8.0MB and 9.0MB, and continues higher of course.
I have attempted the following with no success:
ini_set('memory_limit', '500M');
ini_set('post_max_size', '220M');
ini_set('upload_max_filesize', '220M');
I require the data to pass through HTTP POST. The data cannot be uploaded as a file.
Also could Apache be responsible for this?
Any help would be appreciated.
回答1:
take a look at the documentation comments. when the script is executed, itäs too late to change sopme setting, wich includes post_max_size, for example. to change these values, try to use a .htaccess-file like this:
php_value upload_max_filesize 200M
php_value post_max_size 200M
or change these settings directly in your php.ini.
回答2:
This will help
What are the caveats with increasing max_post_size and upload_max_filesize?
And maybe
http://blurringexistence.net/archives/11-PHPs-max_post_size.html
回答3:
post_max_size is, according to the documentation, defined as a PHP_INI_PERDIR setting. It can be set in your php.ini or .htaccess file. A definition for PHP_INI_PERDIR is given here: http://www.php.net/manual/en/configuration.changes.modes.php
Settings that are defined as PHP_INI_ALL can be set with ini_set().
来源:https://stackoverflow.com/questions/8573664/php-empty-post