Score:0

debian phpfmp chroot and imagemagick - NoDecodeDelegateForThisImageFormat / supported formats:0

cn flag

Friends,

I've setup a chroot-jail with nginx and phpfpm 7.4 from packages.sury.org/php as usual (on Debian 5.10.103-1 bullseye).

Imagemagick fails:

  <?php $im=new Imagick(__DIR__ . '/image.png');

Uncaught ImagickException: NoDecodeDelegateForThisImageFormat `PNG' @ error/constitute.c/ReadImage/575

<?php phpinfo()

"ImageMagick number of supported formats: 0"

Installed version: php7.4-imagick 3.6.0-4+0~20220117.35+debian11~1.gbp149f82

I'd suspect some chroot issue, but afair PHP modules are loaded by PHP's master process and do not required any libraries within the chroot jail. gdlib works. From commandline, imagick works as excpected, so I suppose all required libs are installed. Double checked the jail with a properly working jail on Debian buster, couldn't find any major differences.

Never experienced this before. Any hints?

Update

Noticed an additional problem which might be connected:

<?php system("/usr/bin/id)";
Result code: -1 error_get_last() ->Array (
[type] => 2
[message] => system(): Unable to fork [/usr/bin/id]
[file] => /htdocs/test.php
[line] => 198 )

When I changeroot from commandline with chroot --userspec=myphpfpmuser ... the command /usr/bin/id returns the correct user id. The fpm process is running as this user.

$ ulimit -a
real-time non-blocking time  (microseconds, -R) unlimited
core file size              (blocks, -c) 0
data seg size               (kbytes, -d) unlimited
scheduling priority                 (-e) 0
file size                   (blocks, -f) unlimited
pending signals                     (-i) 256246
max locked memory           (kbytes, -l) 8205255
max memory size             (kbytes, -m) unlimited
open files                          (-n) 1024
pipe size                (512 bytes, -p) 8
POSIX message queues         (bytes, -q) 819200
real-time priority                  (-r) 0
stack size                  (kbytes, -s) 8192
cpu time                   (seconds, -t) unlimited
max user processes                  (-u) 256246
virtual memory              (kbytes, -v) unlimited
file locks                          (-x) unlimited

Anyone any ideas?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.