dongxie548548 2014-10-19 02:45
浏览 1281
已采纳

wkhtmltopdf仅对具有错误HostNotFoundError的本地文件失败

I'm having some trouble with a new install of wkhtmltopdf v0.12.1 64bit on CentOS6

This works perfectly:

/usr/local/bin/wkhtmltopdf http://google.com/ temp.pdf

But the following command fails with HostNotFoundError (where domain.com is the domain of the php file running the shell script):

/usr/local/bin/wkhtmltopdf http://domain.com/ temp.pdf

The same is true for any html file on the domain. Domain.com is resolving normally via a web browser. Also, trying to convert other webpages on different domains which are hosted on the same server works fine.

Any ideas what might be wrong? I suspect something surrounding the server firewall or the user account under which php runs but I can't figure it out.

  • 写回答

1条回答 默认 最新

  • dtpoius74857 2014-10-19 22:42
    关注

    After a lot of searching today I found a solution for this problem. It turns out it has the same root as a common issue running file_get_contents() on a local file. Here is the fix:

    Modify PHP.ini to enable the following:

    extension = php_openssl.dll  //remove the ; to uncomment (enable) this line
    
    allow_url_fopen = on
    

    Hopefully this will help someone else out!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号