473,386 Members | 1,752 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

set_time_limit(), using includes, & strange timeout behaviour

I'm trying to investigate the way PHP behaves in relation to timeouts and included scripts. PHP seems to do very strange things when scripts that include other scripts timeout, or when the included scripts themselves timeout. Just wondering if anyone else has ever investigated this world of mystery, or if they would like to join me in my quest into the unknown!!....??

It appears that in some cases php will return a completely balnk page when a script times out (no "Fatal error...." message, despite 'display errors' being well and truly turned on). Or sometimes it will display the error message. I haven't quite figured out what it is that causes these different behaviors.

It would seem that if you do this:
[PHP]set_time_limit(40);
include 'some_script.php';[/PHP]

For those of you without super-human, badly-coloured-code-reading abilities that's:
<?php set_time_limit(40);
include 'some_script.php'; ?>

Then 'some_script.php' is also given a maximum execution time of 40 seconds.

And this is the bit that's really strange...
If you have this:
[PHP]set_time_limit(20);
include 'tedious_loop.php';
include 'tedious_loop.php';
include 'tedious_loop.php';
include 'tedious_loop.php';[/PHP]
(set_time_limit(20); include 'tedious_loop.php' 4 times)

And 'tedious_loop.php' takes 7 seconds to execute, e.g.:
[PHP]$time=microtime(1)+7;
while(microtime(1)<$time)
{
//do nothing
}[/PHP]
(a loop that does nothing for 7 seconds)

Then your script will sometimes timeout, and sometimes wont (despite the fact that the whole thing will always take 28 seconds). The time that 'tedious_loop.php' takes to execute is not counted as part of the execution time of your main script. Well not entirely anyway. But like I said, sometimes it will cause your script to timeout and sometimes it wont. Can anyone else shed any light on this?
Jun 2 '07 #1
0 1512

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Grzegorz Kaczor | last post by:
Hello all, I've got a VERY strange network problem with Win2k Server and .NET. I've got one central server (hub) getting raw binary data (files) from many locations. Both server and clients...
2
by: Ik Ben Het | last post by:
Hello, I posted a simular question in the "IIS Security" group but it think it is more usefull to post it here. I want to do something very simpel. Make a part of my website available only...
0
by: Grzegorz Kaczor | last post by:
Hello, I've got a VERY strange network problem with Win2k Server and .NET. I've got one central server (hub) getting raw binary data (files) from many locations. Both server and clients are...
2
by: Marty | last post by:
Something strange is happening on my web site since my hosting provider upgraded to Server 2003 a few weeks ago. I use forms authentication in my asp.net application, with essentially the...
30
by: James Daughtry | last post by:
char array; scanf("%19s", &array); I know this is wrong because it's a type mismatch, where scanf expects a pointer to char and gets a pointer to an array of 20 char. I know that question 6.12...
30
by: fritz-bayer | last post by:
Hi, why does the php expression $result = 5543039447 & 2147483648; when executed evaluate to 0, whereas the perl expression $same = 5543039447 & 2147483648 ;
2
by: carl.rosenberger | last post by:
Hi, I am trying to get the following behaviour for my Socket connection: (1) Attempt a blocked read for a defined amount of time. (2) If a timeout occurs, because no data has been sent to the...
3
by: pedalpete | last post by:
I've got some strange behavior happening on my server. I have a php page which runs a few processes to keep my db up to date and optomized. The process can take about 40 minutes to run. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.