我有一个以下 php 脚本 -
<?php
$command = "python webkit2png/webkit2png -D screenshots http://stackoverflow.com";
$command = escapeshellcmd($command);
system($command);
当通过终端运行时
php test.php
它会生成网站截图,但是在浏览器中打开 test.php 不会带来任何结果。
python 和 php 脚本都归 _www 用户所有,apache 在该用户下运行。我什至尝试在终端的 _www 下运行 test.php,它仍然有效。有什么我想念的吗?
感谢@amccausl,我在 apache 日志中找到了这个 -
Wed Feb 27 07:12:03 mini.local python[83331] <Error>: kCGErrorFailure: Set a breakpoint @ CGErrorBreakpoint() to catch errors as they are logged.
_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
Traceback (most recent call last):
File "webkit2png/webkit2png", line 353, in <module>
if __name__ == '__main__' : main()
File "webkit2png/webkit2png", line 324, in main
AppKit.NSBorderlessWindowMask, 2, 0)
objc.error: NSInternalInconsistencyException - Error (1002) creating CGSWindow