473,569 Members | 2,735 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

set_time_limit( ), using includes, & strange timeout behaviour

93 New Member
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.ph p';[/PHP]

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

Then 'some_script.ph p' 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.p hp';
include 'tedious_loop.p hp';
include 'tedious_loop.p hp';
include 'tedious_loop.p hp';[/PHP]
(set_time_limit (20); include 'tedious_loop.p hp' 4 times)

And 'tedious_loop.p hp' 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.p hp' 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 1526

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

Similar topics

0
1524
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 are written in C# The server is quite simple: two threads, one accepts new connections and decides whether the client is authenticated to send data or...
2
1677
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 for users with a username and password. The site is mainly ASP based. The webserver is an IIS6 and I do NOT have access to server settings (session...
0
1239
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 written in C# The server is quite simple: two threads, one accepts new connections and decides whether the client is authenticated to send data or...
2
1468
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 following c# code-behind on my login page: If (FormsAuthentication.Authenticate(UserName.Text, UserPass.Text))...
30
3163
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 of the C FAQ says that it's wrong for that very reason. What I don't know is where the standard tells me conclusively that it's wrong. What I also...
30
1885
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
10685
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 socket, throw an exception. (3) Catch the exception and either go back to (1) or quit reading, depending on a variety of (user defined) factors.
3
2765
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. I've used the following to start my page The values I've set so high because I've been trying to give the processes lots of time to run, but that...
0
7694
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7921
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8118
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6278
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5504
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.