Dr.Kameleon
Dr.Kameleon

Reputation: 22810

Exec command not working

I'm using exec to run a background script like this :

$command = "/usr/local/bin/php public_html/r/index.php tools $action process $params > /dev/null &";
exec($command);

The thing is : it's NOT working.

Hints :

Any ideas?

Upvotes: 1

Views: 1962

Answers (1)

Marc B
Marc B

Reputation: 360572

background jobs tend to have different 'current' directories than your shell - usually it's the home directory of the account that the job is running under. Unless your public_html is in /home/whoever, you're not actually running your script. Try an absolute path:

$command = "/usr/local/bin/php /path/to/public_html/r/index.php etc..."
                               ^^^^^^^^^

instead.

Upvotes: 6

Related Questions