Reputation: 41
I'm running PHP 5.4.30 with imagick module 3.1.0RC2. phpinfo() does show the module as loaded and phpinfo() shows PDF as a supported format.
When running:
$image = new Imagick();
$image->readImage('./test.pdf');
I receive:
Fatal error: Uncaught exception 'ImagickException' with message 'Unable to read the file: ./test.pdf'
When I change the image type to be a JPEG and read './test.jpg'
No errors are returned. Permissions have been check and different PDFs have been tested. I have inserted the absolute path to the image with an exception still being thrown. The images are for this example placed in the same directory alongside the script.
What am I missing?
Upvotes: 4
Views: 5814
Reputation: 61
I had the exact same problem. As command line it worked perfectly fine: convert book.pdf book.jpeg
but pdf didn't seem to work. If not, you may want to install GhostScript
I found the solution on the issue 588918. You simply have to create a symlink of gs
(the GhostScript library) in usr/bin
. Basically, If you do something like
sudo ln -s /usr/local/bin/gs-noX11 /usr/bin/gs
and restart your server it should work. At least it did for me.
Upvotes: 6