How to Run a PHP Script as a Daemon process in Linux ? Is itpossible..? Yes. You can Run the PHP Script as a Daemon process, if you want.How to do this…? In Linux, you can do cron jobs executing your predefined scripts/instructions at predefined times.But, you don’t have to do all of that to Run a PHP Script as a Daemon process.
How to ?
Just make a PHP Script and run the script from the command line, as follows:
nohup php my_php_script.php &
In the above code, the last “&” is the one doing the magic. The “&” put the script in to background.
TO kill the process, use the usual command kill, as follows:
kill ProcessID
These are simple codes, But, comes in handy sometimes.