从php运行phantomjs

从php运行phantomjs,php,phantomjs,Php,Phantomjs,一,;我正在尝试从php运行phantomjs。要检查正确的路径和权限,首先执行以下命令: $output = shell_exec('ls /opt/phantomjs-1.9.2-linux-x86_64/bin/ -l'); echo "<pre>$output</pre>"; 但当我跑步时: $output = shell_exec('/opt/phantomjs-1.9.2-linux-x86_64/bin/phantomjs --version'); var

一,;我正在尝试从php运行phantomjs。要检查正确的路径和权限,首先执行以下命令:

$output = shell_exec('ls /opt/phantomjs-1.9.2-linux-x86_64/bin/ -l');
echo "<pre>$output</pre>";
但当我跑步时:

$output = shell_exec('/opt/phantomjs-1.9.2-linux-x86_64/bin/phantomjs --version');
var_dump($output);
$output=shell_exec('/opt/phantomjs-1.9.2-linux-x86_64/bin/phantomjs--version');
回显“$output”;

输出为空:(为什么?谢谢!

我的第一个猜测是权限问题。是否允许www数据用户(或您的服务器被调用的任何用户)运行该程序

如果将$output放在var_dump()中,您会得到任何返回吗? 即


我得到了同样的错误,我尝试修改目录,在那里我执行phantomjs并将模式设置为777,然后它就工作了。我猜根本原因是php fpm的所有者没有权利将图像写入目录

请参阅我的代码:


是此命令:$output=shell_exec('/opt/phantomjs-1.9.2-linux-x86_64/bin/phantomjs 2>&1');echo$output;输出为:sh:/opt/phantomjs-1.9.2-linux-x86_64/bin/phantomjs:Permission denied。如何更改“apache”用户的权限?
$output = shell_exec('/opt/phantomjs-1.9.2-linux-x86_64/bin/phantomjs --version');
echo "<pre>$output</pre>";
$output = shell_exec('/opt/phantomjs-1.9.2-linux-x86_64/bin/phantomjs --version');
var_dump($output);
$output = passthru('phantomjs echarts-convert.js -options ' . $options . ' -outfile line.png');

echo $output;