次のphpスクリプトがあります-
<?php
$command = "python webkit2png/webkit2png -D screenshots http://stackoverflow.com";
$command = escapeshellcmd($command);
system($command);
ターミナルから実行する場合
php test.php
Web サイトのスクリーンショットが生成されますが、ブラウザーで 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