Solved

Problem running an ImageMagick command through PHP Exec on MAC

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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

867 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

22 Experts available now in Live!

Get 1:1 Help Now