?
Solved

Problem running an ImageMagick command through PHP Exec on MAC

Posted on 2010-09-07
4
Medium Priority
?
1,069 Views
Last Modified: 2013-11-08
Hello,

I have successfully installed ImageMagick (6.6.3-0 2010-07-26 Q16) on my MAC (OSX 10.6.4)

Using XAMPP 0.7.2 (Apache 2.2.8 , PHP 5.2.5, MySQL 5.0.51)

My problem is that i have a PHP Exec command that calls the convert in IM but is not running when i access the PHP file through my browser.

If i call the same PHP file from Terminal , it runs and works fine.

Any assistance on the matter?

Thanks in advance
0
Comment
Question by:jmhabis2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 8

Expert Comment

by:pvlier
ID: 33619040
When run in the browser it has the user-permissions of the webserver (apache). That might not have the permission to run the command. In a terminal you have your own userrights that are different from apache's.
I've seen some discussions about a problem with imagemagick tho and people used ghostscript instead...
0
 

Author Comment

by:jmhabis2
ID: 33619079
if we want to keep using imagemagick, is there any solution for the problem?
thanks
0
 
LVL 8

Accepted Solution

by:
pvlier earned 2000 total points
ID: 33619130
See if apache (user www) has permissions to run imagemagick... Might also be a enviroment problem... See if this applies:
http://studio.imagemagick.org/discourse-server/viewtopic.php?f=1&t=15668 
0
 

Author Comment

by:jmhabis2
ID: 33624668
Hey pviler,

Thanks a lot i was able to find a solution in the link you sent me.

I installed my IM through MacPorts and the executable files were placed in opt/local/bin

the other issue was also related the the www user of Apache not having the permissions to access a certain folder.

so the solution was to run my exec function while using the full path of the convert executable, something like this:

<?php
exec("/opt/local/bin/convert /test/apple-logo.jpg /test/apple-logo.png",$out,$returnval);
print_r($out[0]);
?>
 
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
This article discusses four methods for overlaying images in a container on a web page
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question