0

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

enter image description here

Community
  • 1
  • 1
Thanh Phong
  • 33
  • 1
  • 5

1 Answers1

-1

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.