My request only last 3 min and return 500 Internal Server Error. Here is my apache error_log file:
Script timed out before returning headers: index.php, referer: ...
Can anyone help me how to solve it? I already set execution time but still not working: ini_set('max_execution_time', 0);
Here is my code
public static function compress($source, $destination)
{
ini_set('max_execution_time', 0);
Tinify\setKey(env('API_KEY'));
Tinify\fromFile($source)->toFile($destination);
}
My code only using tinypng api to compress image, i think it's too long
It cause of 1. If you kept sleep function e.g. sleep(5000); 2. PHP version7 make it 5.6 something.
If you did fix please share your answer. Thank You.