[SOLVED] Cannot load PDF with PHP-FPM
Posted: 2014-07-21T22:53:38-07:00
I can't seem to get PDFs to load when running a script using PHP-FPM. Any help would be greatly appreciated. Thanks,
SPECIFICATIONS
OS ~ FreeBSD 10 64bit
PHP ~ 5.5.14
ImageMagick ~ 6.8.9.4
Pecl-Imagick ~ 3.1.2
TEST SCRIPT
ERROR
TEST SCENARIOS
* PDF to JPG using PHP on the CommandLine > works
* PDF to JPG using PHP-FPM from browser > doesn't work (error above)
* JPG to PDF using PHP-FPM from browser > works
SPECIFICATIONS
OS ~ FreeBSD 10 64bit
PHP ~ 5.5.14
ImageMagick ~ 6.8.9.4
Pecl-Imagick ~ 3.1.2
TEST SCRIPT
Code: Select all
<?php
$path = '/tmp/in.pdf';
$pdf = new Imagick($path);
$pdf->setImageFormat('jpg');
$pdf->writeImage('/tmp/out.jpg');
?>
Code: Select all
Fatal error: Uncaught exception 'ImagickException' with message 'Unable to read the file: /tmp/in.pdf' in /usr/local/www/test.php:3 Stack trace: #0 /usr/local/www/test.php(3): Imagick->__construct('/tmp/in.pdf') #1 {main} thrown in /usr/local/www/test.php on line 3
* PDF to JPG using PHP on the CommandLine > works
* PDF to JPG using PHP-FPM from browser > doesn't work (error above)
* JPG to PDF using PHP-FPM from browser > works