how to create continues executing script in php with no execution limit -
I have created a script to listen to continuously with SMSC to capture the delivered SMS I script looks okay, but want to make sure it never stops.
-
It states that the server can interfere with continuous execution and prevent execution, but to disable it, in
httpd.conf No option could get the limit of execution
Second, the script below is going to use
100% CPU ? As some other applications are running on the same server.
What is the better third medium?
Browser or
php CLI ?
2
set_time_limit (0); Do {// read incoming SMS $ sms = $ tx-> readSMS (); // Check SMS data ($ SMS & amp ;! Empty ($ SMS ['source_addr']) & amp; blank ($ sms ['destination_addr']) & amp; FREE! ($ Sms ['Short_message']) ) {// send SMS for processing in smsadv $ = $ sms ['source_addr']; $ = $ Sms ['destination_addr']; $ Message = $ sms ['short_message']; // Insert into database ...} // Check continuous SMS} while (1);
Edit According to the answer given below, I
CLI and without
set_time_limit (0) PHP The script used is that there is no execution limit in the script running through CLI.
You should use a CII script because the common state of use is the server side to provide dynamic web pages. But the PHP script is not designed to run "forever" as suggested in the comments, you can use the frequent scheduler script from the browser. If you do not plan to use a browser, use CLI instead.
Regarding CPU load, you might consider putting
sleep (1) in the loop of your time (in case of you wait for an estimated wait in the comments on the question Instead of voting for incoming SMS.
Comments
Post a Comment