I'm trying to make a PHP script run in the background:
$php -q myscript.php & [1] 12345 $jobs [1]+ Stopped php -q myscript.php
If I force it into the foreground (fg 1) it runs fine, and if I then stop it (ctrl-Z) and force it into the background (bg 1) it continues to run just fine. It's just starting in the background that seems to be a problem.
The script is very simple for test purposes: <?php echo "hello"; ?>
(I've tried various scripts, and obviously if I want to stop it and force it into the background it needs to run longer than this, so I just add a sleep(10); to the code.)
Googling hasn't got me anything except suggestions that what I am doing is fine! I have no idea if this is a PHP issue or a Linux one?
Mark