Be care of the difference of absolute path. relative path. execute path. For example, your dir structure is:
/home/my/php/script/test.php
/makescreen.exe
and in you php script you call shell_exec(makescreen.exe ***)
.
In this case, if you execute your script like cd /home/my/php/script && php test.php
, then the execute path is /home/my/php/script/
and the scirpt will find makescreen.exe
in execute path, here is /home/my/php/script/
However, if you currently stay in /home/my
and use this way php /home/my/php/script/test.php
then the execute path is your current path, here is /home/my
, and the script will find the makescreen.exe
in /home/my
, definitely failed.
If you use /home/my/php/script/makescreen.exe
in your script, this is absolute path and wherever you are, it will find makescreen.exe
in /home/my/php/script/
And if you want to put the executable file in subfolder. you can use relative path subfolder/makescreen.exe
in your script and make sure the script can access it correctly.