我正在尝试这样截屏:
shell_exec("/usr/bin/wkhtmltoimage http://google.com screen.png");
但它不是创建screen.png。但是当我
/usr/bin/wkhtmltoimage http://google.com screen.png
从终端运行时,它按预期工作。我很困惑什么是错的。我试图写日志,如:
shell_exec("/usr/bin/wkhtmltoimage http://google.com screen.png > debug.log 2>&1");
我在 debug.log 上收到日志“QXcbConnection:无法连接以显示已中止(核心转储)”。我在 Ubuntu 上安装了带有 Nginx 的 php7.0。解决方案是什么?如果有人解决了同样的问题,请分享。