Thursday, 15 July 2010

curl - PHP image purging exceeds maximum execution time -


Text after "<" post = "itemprop =" text ">

I am cleaning an old PHP application on a lamp-stack. Everything works normally, but there is a function to purify within the time of request-library. Code takes an image URI

I get a timeout-error after 30 seconds of this kind: Fatal error:. Exceeded maximum execution time in 30 seconds / & LT; PathToFolder & gt; / Device / Request Line 133 is , which is the line if (curl_multi_select ($ MH)! = -1) { on .php. There is nothing wrong with the image URI. I have also tried to maximize execution time of 360 seconds, but it still fails. Infinite loop, maybe? If so, why?

Anyone have any ideas? Public stable function purge ($ uri = '') {if ($ uri == '') {Throw new exception ('Uri is not set'); } $ ChVarnish01 = curl_init ($ uri); $ CHVarnish02 = Curl_init ($ Yuri); $ CHVarnish03 = Curl_init ($ Yuri); Curl_setopt_array ($ chVarnish01, array (CURLOPT_CUSTOMREQUEST = & gt; 'pure', CURLOPT_RETURNTRANSFER = & gt; true, CURLOPT_TIMEOUT = & gt; 5, CURLOPT_HTTPHEADER => array ('varnish: 01'))); Curl_setopt_array ($ chVarnish02, array (CURLOPT_CUSTOMREQUEST = & gt; 'pure', CURLOPT_RETURNTRANSFER = & gt; true, CURLOPT_TIMEOUT = & gt; 5, CURLOPT_HTTPHEADER => array ('varnish: 02'))); Curl_setopt_array ($ chVarnish03, array (CURLOPT_CUSTOMREQUEST = & gt; 'pure', CURLOPT_RETURNTRANSFER = & gt; true, CURLOPT_TIMEOUT = & gt; 5, CURLOPT_HTTPHEADER => array ('varnish: 03'))); $ Mh = curl_multi_init (); Curl_multi_add_handle ($ mh, $ chVarnish01); Curl_multi_add_handle ($ mh, $ chVarnish02); Curl_multi_add_handle ($ mh, $ chVarnish03); $ Active = null; Do {$ mrc = curl_multi_exec ($ mh, $ active); } While ($ mrc == CURLM_CALL_MULTI_PERFORM); While (! Curl_multi_select ($ MH) = -1) ($ active & amp;; amp $ MRC == CURLM_OK) {if {$ make MRC} {= curl_multi_exec ($ MH, $ active); } While ($ mrc == CURLM_CALL_MULTI_PERFORM); }} Curl_multi_remove_handle ($ mh, $ chVarnish01); Curl_multi_remove_handle ($ mh, $ chVarnish02); Curl_multi_remove_handle ($ mh, $ chVarnish03); Curl_multi_close ($ MH); Back true; }


No comments:

Post a Comment