Solved

Problem running an ImageMagick command through PHP Exec on MAC

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
This article discusses four methods for overlaying images in a container on a web page
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

757 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

20 Experts available now in Live!

Get 1:1 Help Now