Solved

Problem running an ImageMagick command through PHP Exec on MAC

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
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 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…

828 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