Jump to content

So... just how solid is max_execution_time?


ikebowen

Recommended Posts

header( "content-disposition: attachment" );
$foo = md5( "foo" );
while ( 1 < 2 )
echo( "$foo\n" );

 

Inexplicably, the code above (and that code alone) blows straight past max_execution_time's 30sec limit and goes on for, as far as I can tell, infinity. Or until a server tech notices. Any ideas why?

 

I wrote up a more detailed dissertation at ikebowen.com; would appreciate it if you guys would take a look. I promise this isn't a site plug, I'm just seriously confounded. This has very little implications on anything, but it's really starting to annoy. Makes no sense at all.

Link to comment
Share on other sites

I have a simelar problem, just phph isnt executing your code... so i would suggest:

 

CHANGE THIS:

while ( 1 < 2 )
echo( "$foo\n" );

 

TO THIS

$display = md5('foo');
$max = 2; // max amoutn of times to run this query.
for($i=0; $i<$max; $i++)     $display .= $display;  // starts from 0, and keeps repeating until it hits the max. ie: value of $max
echo $display;

Link to comment
Share on other sites

I believe ike's issue wasn't getting the code to run twice or whatever $max is;

 

while ( 1 < 2 )
echo( "$foo\n" );

 

simply blows past max_execution_time and will not terminate when expected (after 30 seconds).  It is a curious thing?

 

Because

 

while ( 1 < 2)

is an infinite conditional statement (it can never be reached where 1 > 2; the statement will keep repeating) until..well..until max_execution_time stops it at 30 seconds or whatever that's set to and then it should terminate, however it isn't killing the thread.

Link to comment
Share on other sites

I believe ike's issue wasn't getting the code to run twice or whatever $max is;

 

I understand now. sorry :)

& I'm not completely sure, but it could be changed

by checking PhpInfo for the name or title

and use...

 

ini_set('max_execution_time', '30');

 

Update:

Make sure that is added at the top of any page..

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.