Reputation: 4288
I have ImageMagick, IIS 6, Ghostscript, and PHP 5.3.1 installed on a Windows Server 2008 box and am trying to convert a PDF file into a JPG thumbnail.
However, it doesn't seem to be working-- the call to exec()
produces a return code of 1 (which to my understanding, means that some general error has occurred). The output variable is simply an empty array. $output
is simply an empty array. The same occurs if I use system()
instead of exec()
Running the command from the command line seems to work, so my initial guess would be a simple permission issue... The directory is writable by PHP because the script that uploads a PDF to the directory works, and I have verified that everyone has permission to write to the directory as well.
Also, safe mode is off.
Any ideas as to what the issue could be?
Relevant code:
<?php
$output = array();
$ret = 0;
echo exec('convert D:\content\myfile.pdf[0] D:\content\myfile_thumb_1.jpg', $output, $ret);
var_dump($ret);
?>
Note: While I would test this on Apache on Mac OS X, I can't seem to get ImageMagick or Ghostscript installed correctly.
I've also ensured the following:
UPDATE:
After checking the task manager, convert.exe is being run and is taking up CPU time, suggesting to me that it is file permissions of some sort... I'm going to check it out now.
Upvotes: 3
Views: 2951
Reputation: 4288
It turns out there was a permission issue with something in IIS-- the website ran under a different user than the command from CMD, which obviously results in it not working under IIS because it has lesser permissions than from CMD.
Upvotes: 1