I have a web crawling script I'd like to initiate from a PHP page. It needs to run in the background and be able to be stopped from the page as well. What's the best way of accomplishing this? I know I can run shell line commands from PHP, but it seems like they would not be suitable for something that needs to keep running?
1 Answer
Use PHP's exec() in combination with bash's & like this:
<?php
exec('myscript.py &');
The & causes the process to run in the background.
http://php.net/manual/en/function.exec.php
Possible duplicate: