Ubuntu imageMagick不会从www-data(php)将PDF转换为PNG [英] Ubuntu imageMagick does not convert PDF to PNG from www-data (php)

查看:80
本文介绍了Ubuntu imageMagick不会从www-data(php)将PDF转换为PNG的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我想使用简单的php脚本转换pdf文件时遇到问题:

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");
?>

从终端(SSH连接)进行转换时,转换工作正常,但前提是我必须以自己的身份登录.以下内容将不会显示错误,也不会显示输出文件"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

推荐答案

您的文件/文件夹权限错误,imagemagick(转换)需要写权限:

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

sudo chmod g+w folder

签出 http://www.tuxfiles.org/linuxhelp/filepermissions.html为了获得良好的帮助/解释,文件/文件夹模式"是什么以及它们如何工作.

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

这篇关于Ubuntu imageMagick不会从www-data(php)将PDF转换为PNG的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆