Honesty Rocks! truth rules.

Imagemagick And Php, Help

HOME      >>       Programming

malum

I am running a PHP based web site and have just moved to a Windows server

I can't get Imagemagick to work in PHP.

It works from the command line.

 

I don't have access to the server other than a simple control panel but I can pass info onto the administrator (who also happens to be my buddy)

 

running the test page gives me this

 

Warning: exec() [function.exec]: Unable to fork [convert -version] in D:\home\Customers\virtuallyinsane.com\htdocs\test\test.php on line 11

Version return code is -1

 

test being

 

<html> <head> <title>Test for ImageMagick</title> </head><body> <br /><b>Warning</b>: exec() [<a href='function.exec'>function.exec</a>]: Unable to fork [convert -version] in <b>D:\home\Customers\virtuallyinsane.com\htdocs\test\test.php</b> on line <b>11</b><br />Version return code is -1 <br><ul></ul> </body> </html>

The web based php script has a page to put the path in for Imagemagick but when I do it can't find it, it tell me the path isn't valid (my admin says I shouldn't need the path anyway as it should work from anywhere)

 

Any help appreciated


yordan

malum,You first posted this topic in the "tutorial" forum.Your post is not really a tutorial, looks more like a call for help. :rolleyes:That's why I moved your topic here, where it should most probably have an answer.By the way, I hate this "cannot fork", looks like a memory access or number of process problem.Are you sure that your program should run from the command line ? What happens if you try to run it in a window ?


docduke

Here is a test of ImageMagick with more output details:

<html> <head> <title>Test for ImageMagick</title> </head><body> <?function alist ($array) { //This function prints a text array as an html list. $alist = "<ul>"; for ($i = 0; $i < sizeof($array); $i++) { $alist .= "<li>$array[$i]"; } $alist .= "</ul>"; return $alist;}exec("convert -version", $out, $rcode); //Try to get ImageMagick "convert" program version output.echo "Version return code is $rcode <br>"; //Print the return code: 0 if OK, nonzero if error.echo alist($out); //Print the output of "convert -version"?> </body> </html>
It defines a php function "alist" that parses the output of the "version" query and formats it so that a browser can display it.

Copy and paste this code into a .php file and upload it to somewhere that it can be accessed by your (PHP-supporting) web server. Then load it into a browser. It should tell you just about everything that ImageMagick knows about its environment.

I put a tutorial up on it a while ago: How To Find And Test Imagemagick Using Php. If that doesn't help enough, take a look at Basic Usage on the ImageMagick website. By the way, when you do your command-line check, note whether the version number is above or below 5.5.7. There was a significant change in the way it processes arguments at that point.

Hope this helps!