Write php simple upload image, found 200k picture upload times Internal Server error error, check upload_max_filesize, and other post_max_size, Max_input_time, Memory_ Limit, max_execution_time configuration items are not problematic, check the error log after: Mod_fcgid:http request length 138296 (so far) exceeds Maxrequestlen (131072), Find out where the problem lies.
It turned out to be a setup problem in fastcgi mode, which seems to be because the HTTP request length (138296) is too long and is larger than the existing 131072 maximum request length. After looking at the Fcgid configuration file, I found that the Maxrequestlen parameters were not configured. It seems that the 131072 configuration is the default. So in the Fcgid configuration file to add this configuration, 15728640 is 15M, because my php.ini set the maximum post length is 15M, so set them as long as: Maxrequestlen 15728640
Maxrequestlen 15728640
AddHandler fcgid-script. fcgi. php
# Where to look for the php.ini file?
Fcgidinitialenv PHPRC "E:/wamp/bin/apache/apache2.3.14/bin"
# Set php_fcgi_max_requests to greater than or equal to fcgidmaxrequestsperprocess
# to prevent php-cgi process from exiting before all requests completed
Fcgidinitialenv Php_fcgi_max_requests 1000
# Maximum requests a process should handle before it is terminated
Fcgidmaxrequestsperprocess 1000
# Maximum Number of PHP processes
Fcgidmaxprocesses 15
# Number of seconds of idle time before a php-cgi process is terminated
Fcgidiotimeout 120
Fcgididletimeout 120
#Path to php-cgi
Fcgidwrapper "E:/wamp/bin/php/php5.4/php-cgi.exe". php
# Define the Mime-type for ". php" Files
AddType application/x-httpd-php. php
Inside the "Maxrequestlen" is the fastcgi mode upload file is the maximum file length HTTP accepted.
Problem solving
Note:
PHP default upload limit is maximum 2M, want to upload more than this set of files, need to adjust PHP, Apache and other parameters. Below, we briefly describe some of the parameters involved in uploading PHP files:
File_uploads
: Whether to allow the switch to upload files over HTTP, the default is on is on.
Upload_tmp_dir
: Upload_tmp_dir is used to describe the temporary directory of files uploaded by PHP, to upload files, it is necessary to ensure that the server does not close the temporary files and have write permissions to the folder, if not specified, PHP uses the system default values.
Upload_max_filesize
: Allows the maximum upload file size, which defaults to 2M.
Post_max_size
: Controls the maximum amount of data that PHP can receive in a single form submission using the Post method. If you want to use PHP file upload functionality, you need to change this value to be larger than upload_max_filesize.
Max_input_time
: The time to receive data by post, get, and put is limited in seconds. If your application is running on a low-speed link, you need to increase this value to accommodate the additional time it takes to receive the data.
Memory_limit
: PHP allows you to define memory usage limits in order to avoid running scripts that use the system's available memory heavily. The Memory_limit variable is used to specify the maximum memory capacity variable that a single script can use memory_limit the value should be appropriately greater than the value of post_max_size.
Max_execution_time
: Max_execution_time sets the time at which PHP waits for the script to complete before forcing the script to terminate, which is calculated in seconds. This variable is useful when the script enters an infinite loop state. However, this feature also causes the operation to fail when there is a legitimate activity that takes a long time to complete, such as uploading large files. In such cases, you must consider increasing the value of this variable to avoid PHP closing the script when the script is performing some important process.
For Linux hosts, there may also be php.conf files under/etc/httpd/conf.d/access.conf/, which may solve some system file size limitation issues.