0

I have sequential function call which take few seconds of processing time. I faced this error:

image

Is there any way to remove this error?

I got this answer from previous threads:

You should check the max_execution_time setting in the php.ini files on your server and on your local installation.

Is there any other solution for this?

MyURLDecode is as below:

function MyURLDecode($url) 

{

    $ch = curl_init();

    curl_setopt_array($ch, array(

    CURLOPT_URL => $url,

    CURLOPT_HEADER => false,

    CURLOPT_NOBODY => true,

    CURLOPT_FOLLOWLOCATION => true,));

    curl_exec($ch);

    $follow_url = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);

    curl_close($ch);

    return $follow_url;

}
user2129623
  • 2,167
  • 3
  • 35
  • 64
  • I think curl code is timing out. Set `CURLOPT_TIMEOUT` to 5 seconds and check curl error. – Shiplu Mokaddim Jan 13 '14 at 06:57
  • you can increase the max execution time of PHP in php.ini file. It's usually found in `/etc/php5/apache2/php.ini` on your server then edit the line `max_execution_time = 30` and increase it to something higher. – adamS Jan 13 '14 at 06:59
  • @adamS: that is one solution as I mentioned in my question. IS there any other way to remove this error? – user2129623 Jan 13 '14 at 07:00
  • you could try these php functions http://www.php.net/manual/en/info.configuration.php#ini.max-execution-time , http://www.php.net/manual/en/function.set-time-limit.php – adamS Jan 13 '14 at 07:03
  • possible duplicate of [Fatal error: Maximum execution time of 30 seconds exceeded](http://stackoverflow.com/questions/5164930/fatal-error-maximum-execution-time-of-30-seconds-exceeded) – Balaji Kandasamy Jan 13 '14 at 07:09

2 Answers2

3

One way is to change the max_execution_time in php.ini or on runtime i.e.

ini_set('max_execution_time', <total seconds>);

Another option is you can send your process in background.

Nishu Tayal
  • 20,106
  • 8
  • 49
  • 101
2

Try to set

curl_setopt($ch, CURLOPT_TIMEOUT, 29);
Stafox
  • 1,007
  • 14
  • 25