LeeTee
LeeTee

Reputation: 6601

PHP exec() - how do I test or even know if its running file?

I have the below code to loop through and run an external file. I can't find much info on how to do this properly and its not working.

while($row = mssql_fetch_array($run)){
    $arg = escapeshellarg($row['shopkeeper']);
    exec("php /var/www/clients/client1/web/products/shopmania/index_test.php \"$arg\"> /dev/null 2>&1 &");
}

How can I debug this? Perhaps its finding the file but the $arg isn't being passed properly, but I have no idea how to test and find out.

THanks in advance.

Upvotes: 0

Views: 178

Answers (1)

mosch
mosch

Reputation: 1035

You just shoud do it like that and have a look a the output.

exec("php /var/www/clients/client1/web/products/shopmania/index_test.php \"$arg\"", $output);
print_r($output);

Upvotes: 2

Related Questions