The server CentOS, because it needs to call PHANTOMJS, has installed the PHANTOMJS binaries, and, on Putty, tried PHANTOMJS--version to output normally: 1.9.8.
Then try the following:
exec("phantomjs --version", $o, $e);echo $e;//返回127
Very puzzled, and tried again:
exec("ls", $o, $e);echo $e;//还是返回127
Google for a long time, some people said to use the absolute path, then try again:
#which ls/bin/ls
Then, in PHP, enter:
exec("/bin/ls", $o, $e);echo $e;//还是返回127
View Php.ini,safe_mode=off,disble_functions also did not disable the exec () and system () and other functions, supposedly PHP should have to execute EXEC permissions Ah, replaced by System (), Shell_ EXEC is return 127, I'm going crazy, ask the big God answer, this exec function exactly the miscellaneous
Reply content:
The server CentOS, because it needs to call PHANTOMJS, has installed the PHANTOMJS binaries, and, on Putty, tried PHANTOMJS--version to output normally: 1.9.8.
Then try the following:
exec("phantomjs --version", $o, $e);echo $e;//返回127
Very puzzled, and tried again:
exec("ls", $o, $e);echo $e;//还是返回127
Google for a long time, some people said to use the absolute path, then try again:
#which ls/bin/ls
Then, in PHP, enter:
exec("/bin/ls", $o, $e);echo $e;//还是返回127
View Php.ini,safe_mode=off,disble_functions also did not disable the exec () and system () and other functions, supposedly PHP should have to execute EXEC permissions Ah, replaced by System (), Shell_ EXEC is return 127, I'm going crazy, ask the big God answer, this exec function exactly the miscellaneous
Check the user who is currently running the PHP script
I tested it with the root user, there's nothing wrong with that.
exec or System Run command, the first should be the current run script user has permission to execute this program