• Dear Pleskians! The Plesk Forum will be undergoing scheduled maintenance on Monday, 7th of July, at 9:00 AM UTC. The expected maintenance window is 2 hours.
    Thank you in advance for your patience and understanding on the matter.

Question When will PHP 8.1 be available?

I have compiled gd.so module with AVIF support for the current version of Plesk PHP 8.1.2 version (OS Ubuntu 20.04):

# cat gdinfo.php
<?php
var_dump(gd_info());
?>

# /opt/plesk/php/8.1/bin/php gdinfo.php
array(15) {
["GD Version"]=>
string(26) "bundled (2.1.0 compatible)"
["FreeType Support"]=>
bool(true)
["FreeType Linkage"]=>
string(13) "with freetype"
["GIF Read Support"]=>
bool(true)
["GIF Create Support"]=>
bool(true)
["JPEG Support"]=>
bool(true)
["PNG Support"]=>
bool(true)
["WBMP Support"]=>
bool(true)
["XPM Support"]=>
bool(true)
["XBM Support"]=>
bool(true)
["WebP Support"]=>
bool(true)
["BMP Support"]=>
bool(true)
["AVIF Support"]=>
bool(true)

["TGA Read Support"]=>
bool(true)
["JIS-mapped Japanese Font Support"]=>
bool(false)
}

You can try to backup the original module file with

# mv /opt/plesk/php/8.1/lib/php/modules/gd.so /opt/plesk/php/8.1/lib/php/modules/gd.so_orig

And then place attached to /opt/plesk/php/8.1/lib/php/modules/

But note, that it was compiled by me for testing purposes and I do not guarantee that it will work without any problems.
It was my personal initiative and interest.
I tried to replace original file with your gd.so attached, but i have this error:
Code:
PHP Warning:  PHP Startup: Unable to load dynamic library 'gd.so' (tried: /opt/plesk/php/8.1/lib/php/modules/gd.so (libavif.so.13: cannot open shared object file: No such file or directory), /opt/plesk/php/8.1/lib/php/modules/gd.so.so (/opt/plesk/php/8.1/lib/php/modules/gd.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Interactive shell

php > var_export(gd_info());
PHP Warning:  Uncaught Error: Call to undefined function gd_info() in php shell code:1
Stack trace:
#0 {main}
  thrown in php shell code on line 1

I have OS Ubuntu 20.04 and PHP 8.1.2 with Plesk Obsidian 18.0.55.
Maybe is not compatible with my plesk version?
 
I have updated to the last Plesk version, I have installed PHP 8.4 and when I try to convert an image to AVIF I get this error:

Warning: imageavif(): avif error - Could not encode image: No codec available

Is there anything else I should install or configure?

I made a script to check support and everything seems to be in order:

PHP:
<?php
if (function_exists('imageavif')) {
    echo "imageavif() is available.\n";
} else {
    echo "imageavif() is NOT available.\n";
}


$info = gd_info();
if (isset($info['AVIF Support']) && $info['AVIF Support']) {
    echo "GD extension has AVIF support enabled.\n";
} else {
    echo "GD extension does NOT support AVIF.\n";
}


The result is as expected:

imageavif() is available.
GD extension has AVIF support enabled.
 
Sure!

Server is Debian 11.11, Plesk Obsidian 18.0.67, PHP 8.4.3

PHP:
$original_filename = '/path/to/file.jpg';
$destination_filename = '/path/to/new_file.avif';
// Read file
$image = imagecreatefromavif($original_filename);
imagepalettetotruecolor($image);
imagealphablending($image, true);
imagesavealpha($image, true);
// Save file as AVIF
imageavif($image, $destination_filename);

It creates a 0 byte file and throws that warning. I have all the updates installed. Any clue?
 
Thank you for the information; we were able to reproduce the issue.

The GD extension is compiled with AVIF support, but it relies on libraries provided by the OS vendor.

On Debian 11:
Code:
# apt install -qy libavif-dev libavif-bin

# avifdec --version
Version: 0.8.4 (dav1d [dec]:0.7.1, libgav1 [dec]:0.16.1)
libyuv : unavailable

# avifenc --version
Version: 0.8.4 (dav1d [dec]:0.7.1, libgav1 [dec]:0.16.1)
libyuv : unavailable
So basically, they have built libavif w/o any encoders at all. Finally, it points me to PHP :: Bug #81217 :: imageavif() fails - Segmentation Fault or No codec available.

The internal bug report (id: PPP-67263) has been created. Maybe we will be able to address the issue with the next release.
 
Thanks! Using avif is something I really need because I have a couple applications that use a lot of images and they take a lot of space and will make everything faster. I'll keep an eye on this issue.
 
Back
Top