Is this possible to run a php program like a standalone application? [duplicate]
Possible Duplicate:
Making a distribultable standalone program in PHP
I don't know how to explain my idea...let me explain it by example.... Typically, I can have an application on the client side, when I launch it, it runs, until I close the application. Many desktop application works like that, right? But an application on php server is different, it only start processing when the user make request.... ....
So, my question is, can I make the php program become something like the desktop application, when I start it, it launch, until I kill the program, (for example, when I launch the application, it keeps pinging the google.com, until I stop the application.), doesn't need the user make request to "active" the program... Thank 开发者_如何学Pythonyou.
If you have regular stuff to do, it usually done by cron ( http://en.wikipedia.org/wiki/Cron ), which invokes your script to run on the server.
If you want to start it from a command line, and want to do stuff again-and-again, you can write a while loop like while($end==1) { do(); sleep(100); }
If you want to do a desktop application (which runs on the client, rather than the server), you can use: PHP-GTK http://gtk.php.net/manual/en/tutorials.php
If yours not one of the cases, please clarify.
What you are describing sounds like a daemon process, not a standalone application.
This is possible in PHP, the functionality is included in PEAR's System_Daemon package.
See this tutorial: http://kevin.vanzonneveld.net/techblog/article/create_daemons_in_php/
精彩评论