Technote Details :: Maximum execution time exceeded for CSV import

Issue

I have created a CSV Import Transaction using MX CSV Import-Export. When I try to import a CSV file in my database, I get the following error:

Fatal error: Maximum execution time of 30 seconds exceeded in C:\Program Files\Apache Group\Apache2\htdocs\your_site\includes\tng\tNG.class.php on line 335.

Reason

The CSV file you are trying to import contains a large number of records (possibly more than 5,000).

Solution

You can solve this problem in two ways:

  • Split the CSV file into several, smaller CSV files and upload each one separately.
  • Modify the max_execution_time directive in php.ini to allow the execution of scripts to take longer.

To modify the value of the max_execution_time directive, follow these steps:

  1. Locate the php.ini file on your server (or your local machine). On Windows, it is usually located in C:\windows\
  2. Open the php.ini file in a text editor.
  3. Search for max_execution_time and set its value to a greater one (the value is specified in seconds).
  4. Save the file and close it.

Simon Guest - 08-04-2005 05:52:47 GMT +2
Alternatively, you can override the setting in php.ini at script level by inserting this directive:

set_time_limit(120);

Where the numerical value is the time (in seconds) you want PHP to wait before timing out the script. It's worth noting that the webserver (e.g. apache) could have a timeout which will take precedence over this setting though.  This could be the ideal solution though to those on shared hosting environments or to maintain maximum portability of code,



Home > Support > Knowledge Base > Technote Details
Search the Knowledge Base
© Adobe Systems Romania. All rights reserved.