Reputation: 2584
I have an application where I need to run a PHP script by exec() function of php.
"php /var/www/server/data/scripts/ThreadHandler.php 145596 > /var/www/server/data/logs/threads/thread.145596.log 2>&1 &"
also tried
"php /var/www/server/data/scripts/ThreadHandler.php 145596 > /var/www/server/data/logs/threads/thread.145596.log 2>&1 "
I am running above command with exec()
function of PHP, but it is not getting run, I can't track any error. please suggest any change.
Upvotes: 1
Views: 431
Reputation: 4549
try
passthru('php -f /var/www/server/data/scripts/ThreadHandler.php 145596 >
/var/www/server/data/logs/threads/thread.145596.log 2>&1');
Also, try to run it from linux command line
Upvotes: 1
Reputation: 1343
Try defining $output and $return_var arguments for exec and print their values :
$output = array();
$rv = null;
exec("your command", $output, $rv);
print_r($rv);
print_r($output);
Upvotes: 1