For a php script to run on a server in the background after closing ssh connection, it needs to be started the following way:
nohup php -q /path/to/your/daemon.php < /dev/null &- nohup (no hung-up) enables the script to keep running after the ssh connction is closed,
- the -q parameter prevents php from outputting any headers that would normally output for a HTTP connection,
- < /dev/nul (the null device) is a workaround as php cli on ubuntu seems to expect some input
- & - the ampersand makes the script in the background
Comments
I'd vetnrue that this article
I'd vetnrue that this article has saved me more time than any other.
Post new comment