You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have looked at the list of the existing issues (including closed issues) and searched if my issue has been already reported
I have tried to resolve the issue myself and will describe what I did in clear and concise manner
Describe the bug
I cannot get PDF to JPG conversion running under PHP-FPM using latest PHP 8.3.3 / imagick 3.7.0 (php8.3-imagick package) / Imagemagick 6.9.11.60 on a Debian Bookworm 12.5 system. The below script to reproduce works fine with any demo.pdf file in the same directory if run with php-cli from command line, but not if run from the browser with php-fpm, failing on readImage():
All other image to image conversions work fine. Just seems to be an issue with PDF files.
It also works fine under PHP 8.2.16 (php8.2-imagick package), with exact same FPM configuration.
I would like to point out that I was unable to reproduce this under Homebrew PHP 8.3 install (see Additional context section below) / PHP-FPM, so I assume this issue only occurs on DEB.SURY.ORG php8.3-imagick package. Please correct me if I am wrong and this is a known issue of ImageMagick 3.7.0 under PHP 8.3
To Reproduce
Create a demo.php file with the following content:
Imagick extension is installed as specific version release, php8.3-imagick package from DEB.SURY.ORG
Imagick is compiled with the same Imagemagick version as the library version on the system, ImageMagick 6.9.11-60 Q16 x86_64 2021-01-25 (according to phpinfo, running over PHP-FPM)
diff /etc/php/8.3/cli/php.ini /etc/php/8.3/fpm/php.ini - no relevant diff except memory_limit 1024M (CLI) vs. 256M (FPM)
Ghostscript is installed and which gs resolves to /usr/bin/gs
phpinfo via FPM shows $_SERVER['PATH'] = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' – so /usr/bin is in the $PATH and accessible by the FPM pool's user (also checked ACLs with getfacl, no restrictions there!)
I have also tried to reproduce this issue on macOS Homebrew PHP 8.3.3 running as PHP-FPM under Nginx (using Laravel Valet), imagick installed via PECL. phpinfo shows ImageMagick 7.1.1-29 Q16-HDRI aarch64 21991 and the PDF-to-JPG conversion via FPM (using the same demo.php script as above) works just fine without any errors.
The text was updated successfully, but these errors were encountered:
Frequently asked questions
Describe the bug
I cannot get PDF to JPG conversion running under PHP-FPM using latest PHP 8.3.3 / imagick 3.7.0 (
php8.3-imagick
package) / Imagemagick 6.9.11.60 on a Debian Bookworm 12.5 system. The below script to reproduce works fine with anydemo.pdf
file in the same directory if run with php-cli from command line, but not if run from the browser with php-fpm, failing onreadImage()
:All other image to image conversions work fine. Just seems to be an issue with PDF files.
It also works fine under PHP 8.2.16 (
php8.2-imagick
package), with exact same FPM configuration.I would like to point out that I was unable to reproduce this under Homebrew PHP 8.3 install (see Additional context section below) / PHP-FPM, so I assume this issue only occurs on DEB.SURY.ORG
php8.3-imagick
package. Please correct me if I am wrong and this is a known issue of ImageMagick 3.7.0 under PHP 8.3To Reproduce
Create a
demo.php
file with the following content:put some
demo.pdf
into the same directory and run it from CLI:the resulting
demo.jpg
will get correctly generated. But not if you run the script from PHP-FPM via your browser, getting the following error instead:Your understanding of what is happening
Imagick seems to prevent access to the
demo.pdf
file or can somehow not access the underlyinggs
binary for the image conversion.What steps did you take to resolve issue yourself before reporting it here
What I checked so far:
php8.3-imagick
package from DEB.SURY.ORGImageMagick 6.9.11-60 Q16 x86_64 2021-01-25
(according to phpinfo, running over PHP-FPM)diff /etc/php/8.3/cli/php.ini /etc/php/8.3/fpm/php.ini
- no relevant diff exceptmemory_limit
1024M (CLI) vs. 256M (FPM)which gs
resolves to/usr/bin/gs
$_SERVER['PATH'] = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
– so/usr/bin
is in the$PATH
and accessible by the FPM pool's user (also checked ACLs withgetfacl
, no restrictions there!)"gs"
in/etc/ImageMagick-6/delegates.xml
by absolute paths"/usr/bin/gs"
/etc/ImageMagick-6/policy.xml
: no restrictions for PDF files (see below)Expected behavior
The
demo.jpg
thumbnail should get created from the PDF's first page without any errors.Distribution:
Package(s):
Additional context
I have also tried to reproduce this issue on macOS Homebrew PHP 8.3.3 running as PHP-FPM under Nginx (using Laravel Valet), imagick installed via PECL. phpinfo shows
ImageMagick 7.1.1-29 Q16-HDRI aarch64 21991
and the PDF-to-JPG conversion via FPM (using the samedemo.php
script as above) works just fine without any errors.The text was updated successfully, but these errors were encountered: