I'm running a shell command through a PHP script.
convert -rotate +0 -background transparent "/var/www/html/uploadfiles/1250077554_66_927STEM-115.jpg" /var/www/html/temp/source1.png
I try this command line and it works. But source1.png isn't created when this is run through PHP. All the files and folders exist and have full write permissions. PHP has been tested and is able to create other files, just not files through command line with imagemagick.
Any help appreciated.
permission problems with PHP and imagemagic
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: permission problems with PHP and imagemagic
you do not show your PHP command. note that you likely need to provide the full path to convert, usually /usr/local/bin/convert
Re: permission problems with PHP and imagemagic
You want to read the image in first; you do not need full paths to the folders etc. relative ones will do.
Try with this error reporting:
There could be a path problem or as Fred says you may need to give the path to convert; find that with this code:
This should be posted in the users section.
Try with this error reporting:
Code: Select all
<?php
$array=array();
echo "<pre>"
exec("convert /var/www/html/uploadfiles/1250077554_66_927STEM-115.jpg -background transparent -rotate +0 /var/www/html/temp/source1.png 2>&1", $array);
echo "<br>".print_r($array)."<br>";
echo "</pre>";
?>
Code: Select all
<?php
echo "<pre>";
system("type convert");
echo "</pre>";
?>
Re: permission problems with PHP and imagemagic
So the apache error logs showed that when run from PHP it wasn't finding imagemagick. "command not found"
Changing the commands to use the full path fixed the problem. /usr/local/blah/blah/convert
Changing the commands to use the full path fixed the problem. /usr/local/blah/blah/convert