user231410
user231410

Reputation: 139

Very long PHP operation: 500 Internal Server Error

I am reading 10,000 csv files each has 1000 rows and remove the duplicate and create new file

For that

  1. I read line by line and store the data in a array.
  2. When I store new data in the array, I check the weather it is not duplicate (weather the array already have the data)
  3. Then recreate csv using array

Additionally I changed following in the php.ini

max_execution_time = 30000 
max_input_time = 60000 
memory_limit = -1 
error_log = error_log

But I am getting following error. There is no error log. Is there any other configuration to change in the php.ini. Please help me on it

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [email protected] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Upvotes: 0

Views: 2492

Answers (2)

Shekhar verma
Shekhar verma

Reputation: 16

500 error can give due to timeout. This can be happen from PHP and Apache2 configuration.

Suggested configuration for php.ini

max_execution_time = 30000 
max_input_time = 60000 
memory_limit = -1 

Also, increase TimeOut in httpd.conf (in server config or vhost config).

Upvotes: 0

tovishalck
tovishalck

Reputation: 1000

Apart from checking for the Apache Timeout, you should try to break this script once & try to run it in batches of probably 2000 csv files. It is also possible that some data in one of the CSV files is causing this error, which would be identified if you break it in batches of 2000 files & run.

Upvotes: 1

Related Questions