Page 1 of 1

PHP Exec Command on Convert

Posted: 2010-07-19T12:45:40-07:00
by mqualls
I am attempting to convert PDFs to TIFs via the PHP exec command using convert

The command works just fine from the command line; I get nothing from PHP ... no errors, nada ...

We are on:
IIS 6.0
PHP 5.2.13

Any help appreciated ...

This is a piece of sample code I am attempting to execute:

Code: Select all

$exec_image = 'C:\ImageMagick\convert ' .$_SERVER['DOCUMENT_ROOT'].'/mq_dev/NCPR080411.pdf '.$_SERVER['DOCUMENT_ROOT'].'/mq_dev/NCPR080411.tif;

exec($exec_image, $returncode);

echo $returncode;

Re: PHP Exec Command on Convert

Posted: 2010-07-22T18:10:40-07:00
by fmw42
I don't use windows nor much PHP, but is C:\ImageMagick\convert the proper path to IM convert. Seems rather short. Also perhaps PHP does not use Windows style paths, but maybe unix style?

try just getting something simple like "convert -version" to work. For example, in unix, it would be something like:

<?php
exec("/usr/local/bin/convert -version",$out,$returnval);
print_r($out[0]);
?>

If you cannot get the IM version back, then either you don't have the right path to IM convert or PHP is not configured correctly or PHP needs unix style paths.