Answer the question
In order to leave comments, you need to log in
PHP script not getting exec() result?
I wrote a php script to make life easier, for example there is such a command:
When I run the script from the console, everything works and $result is filled with output.
When I put the script on cron $result empty, I tried something for a solution, nothing helped.
exec("hdparm -t /dev/disk/by-$uuid", $result);
Answer the question
In order to leave comments, you need to log in
As the documentation for exec says , in the notes section
Note:
If you are going to use this function in a program running as a daemon, make sure that the standard output of the function is directed to a file or other stream, otherwise PHP will hang until the end of the program.
Note:
On Windows, the exec() function starts cmd.exe to run the command. If you want to run an external program without running cmd.exe, then use the proc_open() function with the bypass_shell option set.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question