I connect to a dedicated server with SSH. Next I'm trying to execute in php -d max_execution_time[=0] -f index.php . How can I close (even shut down) my local machine, but my php script on remote server should continue working?


Or with screen http://en.wikipedia.org/wiki/GNU_Screen

screen -A -m -d -S whatever ./yourphpscriptlauncher.sh

The cool +, with:

screen -r whatever

You are again at your script ;)

  • +1 for screen. It's useful in other situations too. Alternatively try tmux which is similar to screen – Adrian Mester Dec 15 '10 at 14:58
  • i use screen on all my production machines to run all sort of scripts (php and python) – s.mihai Dec 15 '10 at 17:02

Run your php script like that: ssh user@machine "nohup php -d max_execution_time[=0] -f index.php &"

  • 1
    This won't work as written, because when you run a command as an argument to SSH, no TTY is allocated. nohup requires a TTY to detach from. It will work fine if you SSH in, get an interactive shell, and then run the command through nohup, however. The best way to do this non-interactively is probably to submit a command to atd with at now that runs immediately. – jgoldschrafe Dec 15 '10 at 14:49

There are a couple of ways listed here:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.