I have used cron to run PHP:
* * * * * /var/www/html/new12345/testing.sh
This bash contains:
#!/usr/bin/php -q /var/www/html/new12345/shell_call.php
and my shell_call.php has a variable:
$a= shell_exec("./main.sh $l");
My main.sh is suppose to return a particular filename which it returns when executed in terminal.
However, when I try to run main.sh from this procedure, I find value of a to be null.
I’d look at the working directory for the php scripts as the first suspect. try:
$a= shell_exec(dirname(__FILE__). "/main.sh $l");