running a server continually????

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
amir1981
Forum Newbie
Posts: 3
Joined: Tue Jun 07, 2005 11:21 am

running a server continually????

Post by amir1981 »

hi! i wrote a proxy server whith php,which should run continully
i run it by cli (with #!/user/bin/php -q) and also i use the cammand
set_time_limit(0); but after a while ,the server shutdown it!!!
i try to use cron job to run it(for example for every minute)but it doesn't
work!!! what is the problem?why the cron dosen't work?
is it any way to acheive this work?
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

If you start something in a shell... it will only run as long as you are logged in (More or less...)

If your host allows it:

The easiest:
php -q "whateverscript.php" & will make the script run in the background.

Another option is to use "screen" and after you've started the script detach and log out.
Post Reply