Re: Maximum Execution Time

26 views
Skip to first unread message

TechnoSophos

unread,
Dec 31, 2013, 11:13:12 AM12/31/13
to support-...@googlegroups.com
One strategy is to use set_time_limit() inside of the loop: http://www.php.net/manual/en/function.set-time-limit.php


On Tue, Dec 31, 2013 at 8:33 AM, KenJ <kje...@gmail.com> wrote:
I'm using a foreach loop to work thru an array of links:

    for ($i = 0; $i < 50; ++$i) {
            $j = $i + 1;
            $qp = htmlqp($links[$i]->'source', 'body', array('timeout' => 240.0));
            echo '<h1>' . $j . ') Page URL is: ' . $links[$i]->'url' . '</h1>';
            $text = $qp->find('div.details-text')->text();
            echo $text . '<br>';
    }

I'm getting an exception when I run more than 30 or so links:

PHP Fatal error: Maximum execution time of 30 seconds exceeded in /var/www/queryPath/CssEventHandler.php on line 1419

I assumed that creating a new instance of $qp each iteration would reset the execution time but apparently not. I even tried to increase the timeout value but I still get the error.

How can I increase/reset this execution time value?


--
You received this message because you are subscribed to the Google Groups "support-querypath" group.
To unsubscribe from this group and stop receiving emails from it, send an email to support-queryp...@googlegroups.com.
To post to this group, send email to support-...@googlegroups.com.
Visit this group at http://groups.google.com/group/support-querypath.
For more options, visit https://groups.google.com/groups/opt_out.



--
http://technosophos.com
http://querypath.org

KenJ

unread,
Dec 31, 2013, 4:22:17 PM12/31/13
to support-...@googlegroups.com
That's what I ended up doing. Thanks!
Reply all
Reply to author
Forward
0 new messages