Sunday, 14 August 2011

File Uploading problem in Wordpress blog Application

I faced a problem in wordpress blog appliation while uploading files. The errors are HTTP Error and IO Error. We could upload only smaller files to our wordpress application. I have updated the php’s configuration file and set maximum uploading file size to 20MB.
upload_max_filesize = 20M
post_max_size = 20M
But still users were getting the same problem.
After doing some searching in internet I found that the following values I have to change in php configuration file
  • max_input_time
  • max_execution_time
  • default_socket_timeout
if they are not set high enough. These values have to be higher than the maximum upload time. So I set these values to a high value (30 minutes)
max_input_time = 1800
max_execution_time = 1800
default_socket_timeout = 1800
After doing the above changes also, I was  not able get any success.
So I did some testing with different file sizes I could conclude that the problem is in fact with Apache web server setting.

Finally I got the solution, the solution was to change the value of LimitRequestBody.
The LimitRequestBody directive allows the user to set a limit on the allowed size of an HTTP request message body within the context in which the directive is given (server, per-directory, per-file or per-location). If the client request exceeds that limit, the server will return an error response instead of servicing the request.

In our web server the value of LimitRequestBody was set to 1048576, i.e. 1 MB. That’s why the file uploading problem was coming when we were uploading bigger files. I changed the value of LimitRequestBody to 0. i.e. to unlimited size.

Now I could upload bigger files (it is up to 20MB as defined by php.ini parameter) to wordpress application.

জয় আই অসম,
প্রণব শর্মা