goodby/csv

Fatal error: Maximum execution time

Closed this issue · 6 comments

When I have a large data in CSV file (in my case, I have the data with 24 columns and 1000 rows need to be imported), it's will have the error

Fatal error: Maximum execution time of 30 seconds exceeded...

Would you like to check to avoid this issue?

The problem is if I'm using a server and I don't have permission to modify PHP maximum execution time setting, how can I increase it. And how can we determine what time is enough if we have a very big data to import ???

suin commented

Did you try set_time_limit() above?

I have tried to call set_time_limit(0)

if ($count === 0) {
$stmt = $pdo->prepare('INSERT INTO user (id, name, email) VALUES (?, ?, ?)');
$stmt->execute($columns);
set_time_limit(0);
}
...

but it can't work well.

suin commented

Humm... You should contact your server admin.
It seems that you have no permission to change that limitation.
If safe-mode is enabled by php.ini, you have no way to increase that.

http://php.net/manual/en/ini.sect.safe-mode.php#ini.safe-mode

Hummm... I'll contact my server admin to find a solution for this.
Another one, I have tried to debug, it seems that we always have an exception error at the end.
Can you check?

try {
echo "importing.........";
$lexer -> parse($path, $interpreter);
} catch (\Exception $e) {
echo "error.........";
$result['error'] = 'error message';
}