gpt4 book ai didi

php - 在 PHP 中运行 inkscape

转载 作者:IT王子 更新时间:2023-10-29 00:31:23 25 4
gpt4 key购买 nike

我需要在 PHP 中运行 inkscape,以便将 svg 图像转换为 PDF。但是每次我尝试:

//some PHP code system("inkscape -z --file=svg.svg --export-pdf=pdf.pdf"); //more code

我没有得到新文件,但我在 apache 错误日志中得到了这个。

(inkscape:28607): libgnomevfs-WARNING **: Unable to create ~/.gnome2 directory: Permission > denied

Emergency save activated! Emergency save completed. Inkscape will close now. If you can reproduce this crash, please file a bug at www.inkscape.org with a detailed description of the steps leading to the crash, so we can fix it. ** Message: Error: Inkscape encountered an internal error and will close now.

Segmentation fault

我在带有 apache 服务器的 ubuntu 上运行。我该怎么做才能解决这个问题?

最佳答案

这与系统权限有关,更简单的修复方法是在运行该代码的用户的根主文件夹中创建一个 .gnome2 文件夹并授予其写入权限(666 应该没问题).

请注意,如果您通过以 . (Linux 上的隐藏文件),可能不会显示在列表中,具体取决于您客户端的配置。

例如:

mkdir -p /var/www/.gnome2 /var/www/.config /var/www/.config/inkscape
chmod 755 /var/www/.gnome2 /var/www/.config /var/www/.config/inkscape
chown -R www-data /var/www/.gnome2 /var/www/.config /var/www/.config/inkscape

关于php - 在 PHP 中运行 inkscape,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3219507/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com