• We value your experience with Plesk during 2024
    Plesk strives to perform even better in 2025. To help us improve further, please answer a few questions about your experience with Plesk Obsidian 2024.
    Please take this short survey:

    https://pt-research.typeform.com/to/AmZvSXkx
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Question How to enable FFI extension for php7.4 fpm

markusva

New Pleskian
I need to have the FFI extension for php7.4 FPM enabled but it does not seem to be available in the extension list.
No effect my putting this to the php.ini
extension=ffi
ffi.enable=true
Any advise how to install and activate it?

Plesk Obsidian 18.0.38 Update #2 running on Ubuntu 20.04.3 LTS
 
Tried to compile this extension but PHP version is higher than required:

Code:
# /opt/plesk/php/7.4/bin/pecl install channel://pecl.php.net/ffi-0.3
WARNING: channel "pear.php.net" has updated its protocols, use "pecl channel-update pear.php.net" to update
pear/ffi requires PHP (version >= 5, version <= 6.0.0), installed version is 7.4.23
No valid packages found
install failed

Maybe anyone knows another method?
 
To enable the FFI extension, PHP has to be configured with --with-ffi.
We don't compile FFI support in our PHP:
Code:
# /opt/plesk/php/7.4/bin/php -i | grep 'Configure Command' | grep -c ffi
0
 
I did how it is described here: Adding Custom PHP Versions (Linux)

The custom CGI seems to work, but the custom FPM version results in a plesk error when I try to change the php settings:
Error: phpinimng failed: configuration test '/usr/local/php-7.4.24/bin/php --test' failed with code 1, and message:
Error in argument 1, char 1: no argument for option -


I configured with:
./configure --with-config-file-path=/usr/local/php --with-ffi --enable-cgi --with-config-file-scan-dir=/usr/local/php/php.d --with-zlib=/usr --enable-mbstring --with-zip --enable-bcmath --enable-pcntl --enable-ftp --enable-exif --enable-calendar --enable-sysvmsg --enable-sysvsem --enable-sysvshm --with-tidy --with-curl --with-iconv --with-gmp --with-pspell --enable-gd --with-jpeg --with-freetype --enable-gd-jis-conv --with-webp --with-zlib-dir=/usr --with-xpm --with-openssl --with-pdo-mysql=mysqlnd --with-gettext=/usr --with-bz2=/usr --with-mysqli --enable-soap --enable-phar --with-xsl --enable-posix --enable-sockets --with-external-pcre --with-libdir=lib64 --with-mysql-sock=/var/lib/mysql/mysql.sock --enable-intl --enable-litespeed --with-fpm-user=www-data --with-fpm-group=www-data --enable-fpm --prefix /usr/local/php-7.4.24

and added it to plesk with:
plesk bin php_handler --add -displayname "Custom PHP 7.4.24" -path /usr/local/php-7.4.24/bin/php -clipath /usr/local/php-7.4.24/bin/php -phpini /usr/local/php-7.4.24/lib/php.ini -type fpm -service php7-fpm -poold usr/local/php-7.4.24/pool.d

Please let me know what I did wrong. Thank you in advance!!!
 
I believe that Plesk should build default PHP versions using --with-ffi configure option.

An easy way to install it for Plesk stock PHP versions without building custom PHP, is to find an ffi.so from another installation with same OS and of course same PHP version.

It works pretty good after getting the ffi.so from a CentOS 7 docker container PHP 8.1 installation using Remi repos and copying it to /opt/plesk/php/8.1/lib64/php/modules/ffi.so and creating a file /opt/plesk/php/8.1/etc/php.d/ffi.ini with contents:

INI:
; Enable ffi extension module
extension=ffi

; FFI API restriction. Possibe values:
; "preload" - enabled in CLI scripts and preloaded files (default)
; "false"   - always disabled
; "true"    - always enabled
ffi.enable=true

; List of headers files to preload, wildcard patterns allowed.
; /usr/share/php/preload used by for RPM packages
; /usr/local/share/php/preload may be used for local files
;ffi.preload=/usr/share/php/preload/*.h:/usr/local/share/php/preload/*.h
 
You have ffi extension in your product, that can't be installed !!! If this bug not fixed in 72 hours, My company will take actions against plesk.
If I pay for your product every month, you will fix the error with FFI, or I will change plesk service.
You have 72 hours before cancelation and claim
 
Hi @paralon, I am afraid you are mistaken to expect that feature as a Plesk feature. If the PHP you are using features FFI you can use FFI. If you choose the Plesk PHP version, that feature may not be part of PHP. But it's your choice what you install or what you do not install on your server. Plesk is not the manufacturer of PHP. If you expect FFI to become an integral part of PHP which is delivered with any PHP basic installation, please complain at the PHP group and request the code change there. I must also ask you to not threaten anyone here or Plesk.
 
Back
Top