我试图在我的网站上使用 wkhtmltoimage 但在这里不起作用是我的测试网站代码
<?php
$output = shell_exec('/usr/local/bin/wkhtmltoimage --quality 95 --width 1024 --height 0 yahoo.com test1.jpg');
echo "<pre>$output</pre>";
?>
输出只是一个空白页。有趣的是当我运行shell_exec(ls -l)
; 而不是
shell_exec('/usr/local/bin/wkhtmltoimage --quality 95 --width 1024 --height 0 yahoo.com test1.jpg');
,它工作正常,当我wkhtmltoimage --quality 95 --width 1024 --height 0 yahoo.com test1.jpg
从我的 ssh 终端运行时,它给了我
Loading page (1/2)
Rendering (2/2)
QPixmap: Cannot create a QPixmap when no GUI is being used ] 25%
QPixmap: Cannot create a QPixmap when no GUI is being used
QPixmap: Cannot create a QPixmap when no GUI is being used
QPixmap: Cannot create a QPixmap when no GUI is being used
QPixmap: Cannot create a QPixmap when no GUI is being used
QPixmap: Cannot create a QPixmap when no GUI is being used
Done
但它会继续创建 jpg 文件。
当我为 yahoo.com 尝试相同的命令时,这就是我得到的
catarplc@zenbile.com [~/public_html]# wkhtmltoimage --quality 95 --width 1024 --height 0 yahoo.com test100.jpg
Loading page (1/2)
Error: Failed loading page http://yahoo.com (sometimes it will work just to ignore this error with --load-error-handling ignore)
Error: Failed loading page http://yahoo.com (sometimes it will work just to ignore this error with --load-error-handling ignore)
不同的网站给了我不同的信息。有人知道发生了什么吗?我雇来做我网站的人说这是服务器问题,不想做任何其他事情,我的网络托管公司一直告诉我 shell_exec() 工作正常并且 wkhtmltoimage 安装正确....我需要双方的帮助我付钱来帮助我并没有帮助我。有人可以帮忙吗???
谢谢