我们正在使用inkscape通过Web表单将上传到我们的服务器的SVG图像转换成。 对于这个inkscape通过-z选项提供了一个批处理模式,但是这个批处理模式有一个缺陷:当inkscape用户运行inkscape ,它会打断
$ inkscape -z -W drawing.svg X11 connection rejected because of wrong authentication. The application 'inkscape' lost its connection to the display localhost:11.0; most likely the X server was shut down or you killed/destroyed the application.
如果你像普通用户那样做,你也会遇到错误:
Xlib: connection to "localhost:11.0" refused by server Xlib: PuTTY X11 proxy: MIT-MAGIC-COOKIE-1 data did not match (inkscape:24050): Gdk-CRITICAL **: gdk_display_list_devices: assertion `GDK_IS_DISPLAY (display)' failed 301.27942
但至lessinkscape给出了正确的答案(在这里数字说明图像的宽度)。
有人知道如何使这也适用于Apache用户? 授权apache使用X(如果是的话)是否有意义? 无论如何,它不觉得是正确的解决scheme…
这种行为是一个公认的错误,让我们希望它会在下一个版本中得到修复: https : //bugs.launchpad.net/inkscape/+bug/666272
同时,我的google-fubuild议运行vnc-server而不是Xvfb。 它可以与X服务器同时运行。 你可以运行它作为apache用户,所以apache将没有问题在该缓冲区显示X应用程序。
这个连接只能通过密码authentication,所以用户连接的是vncviewer。 但请注意,VNC协议不一定安全,因此请务必仅在本地使用,并适当地configuration防火墙。
以apache用户身份启动vnc服务器:
vncserver :2 -geometry 1024x768 – 这只vncserver :2 -geometry 1024x768一次
在由Apache运行的脚本中,只运行应用程序; 不要启动任何vncserver或vncviewer: DISPLAY=:2.0 inkscape -z -W drawing.svg
Google在这里find答案: http : //www.linuxquestions.org/questions/programming-9/can-php-script-execute-x11-applications-811779/
我遇到了类似的问题,修复很简单,只需将Xvfb作为守护程序运行,并使用DISPLAY和适当的xauthconfigurationApache用户(在其环境或启动脚本中)。