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

◇◆丶佛笑我妖孽 提交于 2020-01-07 05:05:23

问题


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

回答1:


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.



来源:https://stackoverflow.com/questions/11266777/ubuntu-imagemagick-does-not-convert-pdf-to-png-from-www-data-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!