PHP Exec Command on Convert

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
mqualls

PHP Exec Command on Convert

Post 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;
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PHP Exec Command on Convert

Post 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.
Post Reply