Page 1 of 1

Using Imagemagick from PHP on Apache Mac Server

Posted: 2015-07-28T05:31:28-07:00
by frodfigu
Hi for all.

I have a problem to execute a simple line of code to convert an image

Code: Select all

<?php
	echo exec("/opt/local/bin/convert foto.jpg -thumbnail 50x50 output.jpg");
?>
I have this path from executing this following code on terminal

Code: Select all

type convert
On my terminal this code works fine and I havenĀ“t to include the path like this:

Code: Select all

convert foto.jpg -thumbnail 50x50 output.jpg
I have an Apache Server installed on my mac, and php works fine on other projects... And this code runs ok on php

Code: Select all

<?php
	echo system("/opt/local/bin/convert -version");
	?>
So anyone can help me? I want to configure php to use Imagemagick commands and without the entire path.

Thank you!!

Re: Using Imagemagick from PHP on Apache Mac Server

Posted: 2015-07-29T01:44:04-07:00
by frodfigu
I can see this error on my Apache Log:

Code: Select all

identify: unable to open image `foto.jpg': Permission denied @ error/blob.c/OpenBlob/2709
Please anyone can help me?

:( :( :(

Re: Using Imagemagick from PHP on Apache Mac Server

Posted: 2015-07-29T09:22:04-07:00
by fmw42
Does PHP have permissions for the directory holding that image?

You may need to set the PHP environment PATH to include the path to IM /opt/local/bin. It probably does not look there by default and is probably looking in /usr/local/bin or /usr/bin. Check your phpinfo.php file to see where it is looking for IM.

Is this your server? If not, ask your ISP.