PHP Exec Not running, but command works ok!
<p>I have the following script to take an uploaded PDF in PHP and call ImageMagik/Ghostscript to convert to images of specified size.</p>

<pre><code>$tmp = exec("convert \"{$strPDF}\" -resize 500X500 \"{$strOut}\"", $results); 
</code></pre>

<p>However, this doesnt seem to work. No errors in the log file and no errors on screen. If I do the following,</p>

<pre><code>$tmp = exec("convert \"{$strPDF}\" -resize 500X500 \"{$strOut}\"", $results); 
echo ("convert \"{$strPDF}\" -resize 500X500 \"{$strOut}\"");
</code></pre>

<p>And I paste the output into a command prompt it works fine (It takes around 6-10 seconds - My max_execution_time is at 600.</p>

<p>Any suggestions on why this might not be working? </p>

<p>This is Windows, IIS 7 and PHP5. </p>

<p>Edit: I'm having the same issue in both CentOS and Windows. Both have ImageMagik and Ghostscript installed.</p>

<p>Edit Edit the below still fails.</p>

<pre><code>$handle = popen("convert \"{$strPDF}\" -resize 500X500 \"{$strOut}\"","r");
        echo "'$handle'; " . gettype($handle) . "\n";
        $read = fread($handle, 2096);
        echo $read;
        pclose($handle);
</code></pre>
