Quantcast
Viewing latest article 5
Browse Latest Browse All 28

SSH: how to run a PHP script in background forever in Linux (CentOS) ?

If you want to run a PHP script in the background forever through SSH then follow these steps:

If you are using a SSH terminal (PuTTY) then directly run following command:

// Notice '&'; that operator will help to run this script forever.
php server.php &

// make sure that you are in the root directory of server.php

Image may be NSFW.
Clik here to view.
ssh outpout

Now your script is running in background and will keep running indefinitely even after closing terminal.

To check if your script is running or not You can run following command:

ps aux | grep server.php

Image may be NSFW.
Clik here to view.
Screenshot_1

If you want to do same thing through PHP instead of terminal then follow this tutorial:
PHP: How to run / execute a script in the background forever through SSH ?

The post SSH: how to run a PHP script in background forever in Linux (CentOS) ? appeared first on Ayyaz Zafar | Freelance Web Developer.


Viewing latest article 5
Browse Latest Browse All 28

Trending Articles