当我从CWP终端进行测试时,我正在使用phantomjs及其工作。我将其安装在usr/local/share/phantomjs
并同时设置环境变量
我从不同目录运行一个常见的From Terminal,以确保其正常工作:phantomjs --version
//响应2.1.1
当我注册新域并创建新的用户Cpanel帐户时。从PHP中,我确保exec函数正常运行,但是当我输入命令phantomjs --version
时要么phantomjs exmple.js
它返回空响应。
代码:
exec("phantomjs --version",$output, $code); // $output = empty. $code = 127
exec("phantomjs example.js",$output, $code); // $output = empty. $code = 127
exec("ls",$output, $code); // (to test if exec working or not) it return files list, and its wroking
我如何允许cpanel用户从PHP exec访问phantomjs?
服务器
Centos 7
PHP 7.2
Cpanel User: dummy
尝试执行文件的直接路径。运行
whereis phantomjs
获取路径并将其传递给exec
。