Jim van der Voort
Jim van der Voort

Reputation: 11

Ubuntu imageMagick does not convert PDF to PNG from www-data (php)

I have a problem when I want to convert a pdf file using a simple php script like:

<?php
    shell_exec("convert pdf.pdf image.png");
?>

The conversion works fine when converting from terminal (SSH connection), but only if I'm logged in as myself. The following will give no error nor an output file 'image.png'.

sudo su www-data
<enters password>
convert pdf.pdf image.png

Upvotes: 0

Views: 1006

Answers (1)

K1773R
K1773R

Reputation: 982

Your file/folder permissions are wrong, imagemagick (convert) needs write permissions:

sudo chmod g+w folder

check out http://www.tuxfiles.org/linuxhelp/filepermissions.html for a good help/explanation what the file/folder "modes" are and how they work.

Upvotes: 2

Related Questions