Page 1 of 1
Putty and starting PHP scripts via shell
Posted: Wed Dec 14, 2005 4:16 pm
by visionmaster
Hello together,
Starting a PHP script using putty, e.g. /opt/lampp/bin/php my_script.php & and closing this putty session, unfortunately closes the started script.
How can I avoid that, since I want to run a few scripts on different internal webservers, but don't want to leave the shell windows open?
Thanks for your help,
visionmaster
Posted: Wed Dec 14, 2005 4:28 pm
by redmonkey
Code: Select all
/opt/lampp/bin/php my_script.php >/dev/null 2>&1 &
Posted: Thu Dec 15, 2005 3:43 am
by visionmaster
redmonkey wrote:Code: Select all
/opt/lampp/bin/php my_script.php >/dev/null 2>&1 &
Thanks for your response. That doesn't work, closing the ssh windows also shuts down the running script.
The command "screen" seems to be the thing I'm looking for.
Posted: Thu Dec 15, 2005 10:07 am
by pickle
You could put the php script in a cron job.
Posted: Mon Jan 02, 2006 9:52 pm
by cggreer
You can force the process to continue executing after you logout or close the terminal windor by prefixing your command with the nohup statement and executing it in the background:
Any output from the process which would normally be sent to the terminal is written to nohup.out in the directory the process was launched from.
Check out
http://wiki.linuxquestions.org/wiki/Nohup for more info about nohup.
Posted: Mon Jan 02, 2006 10:23 pm
by timvw
I usually run all my programs in screen.. This way i can attach and re-attach anytime i want

(Handy for irc etc too

)