Run inkscape in PHP

I need to run inkscape in PHP to convert an SVG image to PDF. However, every time I try:

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

I do not have a new file and I get it in the apache erro log.

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

Emergency rescue activated! Emergency save completed. Inkscape will close. If you can reproduce this failure, write the error at www.inkscape.org. with a detailed description of the steps leading to the failure, so we can fix it. ** Message: Error: Inkscape has detected an internal error and will close.

Segmentation error

I am running on ubuntu with apache server. What can I do to fix this problem?

+6
linux php ubuntu apache inkscape
source share
2 answers

This is due to system rights, an easier way to fix it is to create the .gnome2 folder in the root home folder of the user who runs this code and give him write permissions (666 should be fine).

Please note that if you do this using FTP folders / files starting at. (hidden files on Linux) may not appear in the lists depending on your client configuration.

For example:

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 
+6
source share

Inkscape is run by a regular web server user. The default setting that Ubuntu provides for www data finds the www data home directory in / var / www.

Ther - two possibilities:

a) Changing the home directory of www data to / home / www -data p>

b) Disable VirtualHost in / var / www

In both cases, you need to change the rights of ~ www-data. First, the "chown" directory on www-data: www-data and give them write permissions.

Next time, if you run inkscape through PHP (as the www-data user), the missing directories will be created.

0
source share

All Articles