When submitting a PHP form, the script does not stop

If you submit a PHP form which passes a large amount of data using the POST method, like a file upload form, it would be a good idea to increase the value of the PHP configuration variable post_max_size (you will find it in the php.ini file) if it seems like the script is running forever. post_max_size should be set to a value larger than the maximum sum of the sizes of the files the script is used to upload.

2 thoughts on “When submitting a PHP form, the script does not stop

  1. Not everyone can access the php.ini file so this setting can also be done per dir using htaccess file. Like this:

    php_value post_max_size 40M

    So as you said the post_max_size is the size of all the files plus the size of the data in the form. Also beside this value there are other ini values that may make the upload script not working as:

    • upload_max_filesize is the sum of the sizes of the files posted for upload
    • memory_limit is the size of the memory php is allowed to use and has a role on upload because some of the data uploaded is saved in memory before it is written to disk
    • max_execution_time is the time the script runs so if you upload large file is also a good idea to increase this time
    • max_input_time is the script runs when input sent

    For more information about this variables you can read here: http://www.php.net/manual/en/ini.list.php

Leave a Reply

Your email address will not be published. Required fields are marked *