我試圖使用wkhtmltoimage在我的網站,但沒有工作 這裏是我的測試網站wkhtmltoimage的出放爲NULL
<?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');
的,它工作正常,當我從SSH終端運行wkhtmltoimage --quality 95 --width 1024 --height 0 yahoo.com test1.jpg
,它給了我
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相同的命令,這是我得到 [email protected] [~/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正確安裝....我需要幫助,雙方我付出的幫助我沒有幫助我。任何人都可以幫助嗎?
謝謝