endless loop
Moderator: General Moderators
endless loop
Hi all
I'm having site that sends and receives sms messages. sms-es are beeing sent and recived in my system trough SMPP protocol that works in loop "listening" for new messages.
How can I make endless loop regarding time of execution?
should I do something with
ini_set("max_execution_time",$time_of_execution);
All suggestions are welcome
kind regards
I'm having site that sends and receives sms messages. sms-es are beeing sent and recived in my system trough SMPP protocol that works in loop "listening" for new messages.
How can I make endless loop regarding time of execution?
should I do something with
ini_set("max_execution_time",$time_of_execution);
All suggestions are welcome
kind regards
Code: Select all
set_time_limit(0);- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
sleep() should also be used.
it has passed some time from my last post in this topic, but there are some new dilemmas on this issue
I've made some changes in my script using time loop
but after few minutes script cracks and I get Internal Server Error
what I need is endless loop that will not brake.
all suggestions are welcome
thank you in advance
Kind regards
ddragas
I've made some changes in my script using time loop
Code: Select all
set_time_limit(0);
do{
if ($connected == 0)
{
$smpp->Receive();
sleep(10);
}
}while(time() < (time() + 31536000));what I need is endless loop that will not brake.
all suggestions are welcome
thank you in advance
Kind regards
ddragas
- WaldoMonster
- Forum Contributor
- Posts: 225
- Joined: Mon Apr 19, 2004 6:19 pm
- Contact:
Do you run PHP in safe mode?
From the PHP manual:
From the PHP manual:
Set the number of seconds a script is allowed to run. If this is reached, the script returns a fatal error. The default limit is 30 seconds or, if it exists, the max_execution_time value defined in the php.ini.
...
Warning:
This function has no effect when PHP is running in safe mode. There is no workaround other than turning off safe mode or changing the time limit in the php.ini.
- WaldoMonster
- Forum Contributor
- Posts: 225
- Joined: Mon Apr 19, 2004 6:19 pm
- Contact:
Do you run PHP in safe mode?
From the PHP manual:
From the PHP manual:
Set the number of seconds a script is allowed to run. If this is reached, the script returns a fatal error. The default limit is 30 seconds or, if it exists, the max_execution_time value defined in the php.ini.
...
Warning:
This function has no effect when PHP is running in safe mode. There is no workaround other than turning off safe mode or changing the time limit in the php.ini.
Endless Loop
Why not set a Cron on the server that calls your script, say every 30 seconds? Just be sure to limit how much work the script does each time so it has an end point
Will Earp
Will Earp