Solved

Problem running an ImageMagick command through PHP Exec on MAC

Posted on 2010-09-07
4
1,045 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
  • 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 500 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

813 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now