Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/272.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php /usr/local/bin/wkhtmltopdf:在Linux中被拒绝的权限_Php_Linux_Wkhtmltopdf_Permission Denied - Fatal编程技术网

Php /usr/local/bin/wkhtmltopdf:在Linux中被拒绝的权限

Php /usr/local/bin/wkhtmltopdf:在Linux中被拒绝的权限,php,linux,wkhtmltopdf,permission-denied,Php,Linux,Wkhtmltopdf,Permission Denied,我几乎阅读了所有关于wkhtmltopdf的主题,但我的问题仍然存在。实际上,这不是一个wkhtmltopdf问题,而是一个权限问题 总而言之:wkhtmltopdf在命令行中工作,但在PHPexec()中不起作用 但是wget可以与php exec()配合使用: 我可以在命令行中执行wkhtmltopdf,工作正常: /usr/local/bin/wkhtmltopdf“test.html”“/var/www/html/test/test.pdf” exec("/usr/local/bin/w

我几乎阅读了所有关于
wkhtmltopdf
的主题,但我的问题仍然存在。实际上,这不是一个
wkhtmltopdf
问题,而是一个权限问题

总而言之:
wkhtmltopdf
在命令行中工作,但在PHP
exec()
中不起作用

但是wget可以与php exec()配合使用:

我可以在命令行中执行wkhtmltopdf,工作正常:

/usr/local/bin/wkhtmltopdf“test.html”“/var/www/html/test/test.pdf”

exec("/usr/local/bin/wkhtmltopdf——启用插件——编码UTF-8——javascript延迟2000——加载错误处理忽略——禁用智能收缩——图像质量100——方向图——最小字体大小10——页眉间距“0”——页眉顶部“15mm”——页眉html’/tmp/1568618584_generated.html’——页脚左侧“Accume Partners Risk Director”——页脚-右侧“剩余风险报告-第[页]页,共[toPage]”-页脚字体大小“8”-页脚行/tmp/1568618584_generated.html/tmp/R_RM_2110_剩余风险报告.pdf 2>&1“,$output,$pdfGenerateStatus);
打印($output)。“
”; echo$pdfGenerateStatus;
它是返回数组

([0]=>sh:/usr/local/bin/wkhtmltopdf:权限被拒绝)126错误

我正在使用
wkhtmltopdf
0.12.4(带补丁的qt)。 而且

我已将777权限设置为/usr/local/bin/wkhtmltopdf,但未起作用


请查看
sudo-u www/usr/local/bin/wkhtmltopdf“test.html”“/var/www/html/test/test.pdf“
检查www用户是否有权运行wkhtmltopdf。您需要确保您的服务器用户(例如www)有权访问命令、源文件和目标文件的完整路径。chmod+X usr/local/bin/wkhtmltopdf…并检查chown?
exec( "/usr/local/bin/wkhtmltopdf --enable-plugins --encoding UTF-8 --javascript-delay 2000 --load-error-handling ignore --disable-smart-shrinking --image-quality 100 --orientation Portrait --minimum-font-size 10 --header-spacing '0' --margin-top '15mm' --header-html '/tmp/1568618584_generated.html' --footer-left 'Accume Partners Risk Director' --footer-right 'Residual Risk Report -- Page [page] of [toPage]' --footer-font-size '8' --footer-line /tmp/1568618584_generated.html /tmp/R_RM_2110_Residual_Risk_Report.pdf 2>&1", $output, $pdfGenerateStatus);

    print_r($output).'<br>'; 
    echo $pdfGenerateStatus;