Php74 mbstring installed but not enabled

SYSTEM INFORMATION
OS type and version almalinux 8.5
Virtualmin version 6.17

Hi, I installed PHP 7.4 from remi repo. This was an old install and I do not remember how I achieved my current configuration.

There was no problem so far, but recently I encountered my wordpress site unable to open some pages because of mbstring extensions not “installed”

php -m shows these result

php -m 
[PHP Modules]
bz2
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
json
libxml
mbstring
mysqli
mysqlnd
odbc
openssl
pcntl
pcre
PDO
pdo_mysql
PDO_ODBC
pdo_sqlite
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlrpc
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

but opening able.php with this code:

<?php
 $dom = extension_loaded( 'dom');
 $gd = extension_loaded( 'gd');
 $pdo = extension_loaded( 'pdo');
 $mbstring = extension_loaded( 'mbstring');
 $imagick = extension_loaded( 'imagick');
 echo '<p>Hello Bogus Drupal, from Tommy the Geek</p>';
 echo "GD: ", extension_loaded('gd') ? 'OK' : 'MISSING', '<br>';
 echo "dom: ", extension_loaded('dom') ? 'OK' : 'MISSING', '<br>';
 echo "PDO: ", extension_loaded('pdo') ? 'OK' : 'MISSING', '<br>';
 echo "zip: ", extension_loaded('zip') ? 'OK' : 'MISSING', '<br>';
 echo "mbstring: ", extension_loaded('mbstring') ? 'OK' : 'MISSING', '<br>';
 echo "imagick: ", extension_loaded('imagick') ? 'OK' : 'MISSING', '<br>';
?>

shows

Hello Bogus Drupal, from Tommy the Geek

GD: OK
dom: OK
PDO: OK
zip: OK
mbstring: MISSING
imagick: MISSING

what can I do to enable php74 mbstring and imagick?

If you add to your able.php file the following, what does it output:

echo 'Current PHP version: ' . phpversion();

update on able.php

<?php
 $dom = extension_loaded( 'dom');
 $gd = extension_loaded( 'gd');
 $pdo = extension_loaded( 'pdo');
 $mbstring = extension_loaded( 'mbstring');
 $imagick = extension_loaded( 'imagick');
 echo '<p>Hello Bogus Drupal, from Tommy the Geek</p>';
 echo "GD: ", extension_loaded('gd') ? 'OK' : 'MISSING', '<br>';
 echo "dom: ", extension_loaded('dom') ? 'OK' : 'MISSING', '<br>';
 echo "PDO: ", extension_loaded('pdo') ? 'OK' : 'MISSING', '<br>';
 echo "zip: ", extension_loaded('zip') ? 'OK' : 'MISSING', '<br>';
 echo "mbstring: ", extension_loaded('mbstring') ? 'OK' : 'MISSING', '<br>';
 echo "imagick: ", extension_loaded('imagick') ? 'OK' : 'MISSING', '<br>';
 echo 'Current PHP version: ' . phpversion();
?>

and the result is:

Hello Bogus Drupal, from Tommy the Geek

GD: OK
dom: OK
PDO: OK
zip: OK
mbstring: MISSING
imagick: MISSING
Current PHP version: 7.4.27

If you’re using PHP FPM mode you would need to restart php74-php-fpm service, otherwise restart Apache/Nginx.

it is running fcgid, I have restarted both nginx and fpm, same result. Is there a config on php.ini or user.ini that may prevent mbstring and imagick to be enabled?

Oh, when running PHP in FCGID mode with Nginx you should restart corresponding Nginx PHP FastCGI server service. Check System ⇾ Bootup and Shutdown module.

wonderful! After restarting the corresponding nginx php fastcgi server, mbstring is now detected. However imagick is still not detected. Did I miss something?

Here is current installed extensions:

# php74 -m
[PHP Modules]
bz2
calendar
Core
ctype
curl
date
dom
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
igbinary
imagick
intl
json
libxml
mbstring
msgpack
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
readline
redis
Reflection
session
SimpleXML
soap
sockets
SPL
sqlite3
standard
tokenizer
varnish
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

What makes you think it’s not detected? Try creating a small phpinfo.php file calling phpinfo(); function and running. What does it output in regards of imagick?

phpinfo.php show imagick 1 occurence in this section. No other imagick occurences in phpinfo result.

System Linux ns.mdc.sch.id 4.18.0-348.12.2.el8_5.x86_64 #1 SMP Wed Jan 19 14:35:04 EST 2022 x86_64
Build Date Feb 15 2022 13:23:10
Build System Red Hat Enterprise Linux release 8.5 (Ootpa)
Build Provider Remi’s RPM repository https://rpms.remirepo.net/
Server API CGI/FastCGI
Virtual Directory Support disabled
Configuration File (php.ini) Path /etc/opt/remi/php74
Loaded Configuration File /home/user/etc/php7.4/php.ini
Scan this dir for additional .ini files /etc/opt/remi/php74/php.d
Additional .ini files parsed /etc/opt/remi/php74/php.d/10-opcache.ini, /etc/opt/remi/php74/php.d/20-bz2.ini, /etc/opt/remi/php74/php.d/20-calendar.ini, /etc/opt/remi/php74/php.d/20-ctype.ini, /etc/opt/remi/php74/php.d/20-curl.ini, /etc/opt/remi/php74/php.d/20-dom.ini, /etc/opt/remi/php74/php.d/20-exif.ini, /etc/opt/remi/php74/php.d/20-fileinfo.ini, /etc/opt/remi/php74/php.d/20-ftp.ini, /etc/opt/remi/php74/php.d/20-gd.ini, /etc/opt/remi/php74/php.d/20-gettext.ini, /etc/opt/remi/php74/php.d/20-iconv.ini, /etc/opt/remi/php74/php.d/20-intl.ini, /etc/opt/remi/php74/php.d/20-json.ini, /etc/opt/remi/php74/php.d/20-mbstring.ini, /etc/opt/remi/php74/php.d/20-mysqlnd.ini, /etc/opt/remi/php74/php.d/20-pdo.ini, /etc/opt/remi/php74/php.d/20-phar.ini, /etc/opt/remi/php74/php.d/20-simplexml.ini, /etc/opt/remi/php74/php.d/20-soap.ini, /etc/opt/remi/php74/php.d/20-sockets.ini, /etc/opt/remi/php74/php.d/20-sqlite3.ini, /etc/opt/remi/php74/php.d/20-tokenizer.ini, /etc/opt/remi/php74/php.d/20-xml.ini, /etc/opt/remi/php74/php.d/20-xmlwriter.ini, /etc/opt/remi/php74/php.d/20-xsl.ini, /etc/opt/remi/php74/php.d/30-mysqli.ini, /etc/opt/remi/php74/php.d/30-pdo_mysql.ini, /etc/opt/remi/php74/php.d/30-pdo_sqlite.ini, /etc/opt/remi/php74/php.d/30-xmlreader.ini, /etc/opt/remi/php74/php.d/30-zip.ini, /etc/opt/remi/php74/php.d/40-igbinary.ini, /etc/opt/remi/php74/php.d/40-imagick.ini, /etc/opt/remi/php74/php.d/40-msgpack.ini, /etc/opt/remi/php74/php.d/40-varnish.ini, /etc/opt/remi/php74/php.d/50-redis.ini
PHP API 20190902
PHP Extension 20190902
Zend Extension 320190902
Zend Extension Build API320190902,NTS
PHP Extension Build API20190902,NTS
Debug Build no
Thread Safety disabled
Zend Signal Handling enabled
Zend Memory Manager enabled
Zend Multibyte Support provided by mbstring
IPv6 Support enabled
DTrace Support available, disabled
Registered PHP Streams https, ftps, compress.zlib, php, file, glob, data, http, ftp, compress.bzip2, phar, zip
Registered Stream Socket Transports tcp, udp, unix, udg, ssl, tls, tlsv1.0, tlsv1.1, tlsv1.2, tlsv1.3
Registered Stream Filters zlib., string.rot13, string.toupper, string.tolower, string.strip_tags, convert., consumed, dechunk, bzip2., convert.iconv.

Perhaps your extension isn’t loaded in /etc/opt/remi/php74/php.d/40-imagick.ini file?

It should have uncommented extension= directive referring the module’s binary, which looks something like this:

; configuration for php imagick module
extension=imagick.so

it is already uncommented

; Enable imagick extension module
extension = imagick.so

; Documentation: http://php.net/imagick

; Don't check builtime and runtime versions of ImageMagick
imagick.skip_version_check=1

; Fixes a drawing bug with locales that use ',' as float separators.
;imagick.locale_fix=0

; Used to enable the image progress monitor.
;imagick.progress_monitor=0

; multi-thread management
;imagick.set_single_thread => 1 => 1
;imagick.shutdown_sleep_count => 10 => 10

; to allow null images
;imagick.allow_zero_dimension_images => 0 => 0

Please ensure the file actually exists in the correct path, also check the webserver log for any errors.

Yes, this is the case.
Some logs here:

PHP Startup: Unable to load dynamic library 'imagick.so' (tried: /usr/lib64/php/modules/imagick.so (/usr/lib64/php/modules/imagick.so: cannot open shared object file: No such file or directory), /usr/lib64/php/modules/imagick.so.so (/usr/lib64/php/modules/imagick.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

ls /usr/lib64/php/modules/ does not show imagick.so

How can I create the file?
dnf reinstall php74-php-imagick does not create imagick.so in here.

This is not something I can reproduce.

What is the output of:

dnf reinstall php*imag*

Also, how does virtual-server.name - Server Configuration ⇾ PHP Options page look like? Do you have a screenshot?

I must say that it works just fine for me on AlmaLinux with PHP 7.4 from remi.

Here is the output

 dnf reinstall php*imag*
Last metadata expiration check: 1:49:42 ago on Fri 18 Mar 2022 12:53:30 PM WIB.
Dependencies resolved.
================================================================================
 Package                       Arch      Version             Repository    Size
================================================================================
Reinstalling:
 php74-php-pecl-imagick-im6    x86_64    3.7.0-1.el8.remi    remi-safe    148 k

Transaction Summary
================================================================================

Total download size: 148 k
Installed size: 550 k
Is this ok [y/N]: y
Downloading Packages:
php74-php-pecl-imagick-im6-3.7.0-1.el8.remi.x86 200 kB/s | 148 kB     00:00    
--------------------------------------------------------------------------------
Total                                           134 kB/s | 148 kB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1 
  Reinstalling     : php74-php-pecl-imagick-im6-3.7.0-1.el8.remi.x86_64     1/2 
  Cleanup          : php74-php-pecl-imagick-im6-3.7.0-1.el8.remi.x86_64     2/2 
  Running scriptlet: php74-php-pecl-imagick-im6-3.7.0-1.el8.remi.x86_64     2/2 
  Verifying        : php74-php-pecl-imagick-im6-3.7.0-1.el8.remi.x86_64     1/2 
  Verifying        : php74-php-pecl-imagick-im6-3.7.0-1.el8.remi.x86_64     2/2 

Reinstalled:
  php74-php-pecl-imagick-im6-3.7.0-1.el8.remi.x86_64                            

Complete!

restarting nginx and nginx fcgi service, then showing this screenshot below

[PHP information](javascript:hidden_opener(‘hiddendiv_phpinfo’, ‘hiddenopener_phpinfo’))
PHP versions installed 7.4.28
Modules for PHP 7.4 bz2 calendar cgi-fcgi Core ctype curl


date dom exif fileinfo filter ftp
gd gettext hash iconv json libxml
mbstring mysqli mysqlnd openssl pcntl pcre
PDO pdo_mysql pdo_sqlite Phar readline Reflection
session SimpleXML sockets SPL sqlite3 standard
tokenizer xml xmlreader xmlwriter xsl zip
zlib
Pear modules for PHP 7 Archive_Tar Console_Getopt PEAR PEAR_Manpages Structures_Graph XML_Util

Operating system AlmaLinux Linux 8.5
Webmin version 1.990 Usermin version 1.834
Virtualmin version 6.17 Authentic theme version 19.85.1
Time on system Friday, March 18, 2022 2:51 PM Kernel and CPU Linux 4.18.0-348.12.2.el8_5.x86_64 on x86_64
Processor information AMD EPYC 7601 32-Core Processor, 2 cores System uptime 34 days, 22 hours, 04 minutes

What have happened to the default PHP 7.2 pre-installed by default?

What is the output of:

dnf list | grep php | grep @

It looks that you have deleted basic default packages.

dnf list | grep php | grep @
gd3php.x86_64                                                     2.3.3-4.el8.remi                                   @remi-safe           
oniguruma5php.x86_64                                              6.9.7.1-1.el8.remi                                 @remi-safe           
php.x86_64                                                        7.4.28-1.el8.remi                                  @remi-modular        
php-cli.x86_64                                                    7.4.28-1.el8.remi                                  @remi-modular        
php-common.x86_64                                                 7.4.28-1.el8.remi                                  @remi-modular        
php-fedora-autoloader.noarch                                      1.0.1-2.el8.remi                                   @remi-safe           
php-fpm.x86_64                                                    7.4.28-1.el8.remi                                  @remi-modular        
php-gd.x86_64                                                     7.4.28-1.el8.remi                                  @remi-modular        
php-json.x86_64                                                   7.4.28-1.el8.remi                                  @remi-modular        
php-mbstring.x86_64                                               7.4.28-1.el8.remi                                  @remi-modular        
php-mysqlnd.x86_64                                                7.4.28-1.el8.remi                                  @remi-modular        
php-odbc.x86_64                                                   7.4.28-1.el8.remi                                  @remi-modular        
php-opcache.x86_64                                                7.4.28-1.el8.remi                                  @remi-modular        
php-pdo.x86_64                                                    7.4.28-1.el8.remi                                  @remi-modular        
php-pear.noarch                                                   1:1.10.13-1.el8.remi                               @remi-modular        
php-pecl-zip.x86_64                                               1.20.0-1.el8.remi.7.4                              @remi-modular        
php-process.x86_64                                                7.4.28-1.el8.remi                                  @remi-modular        
php-sodium.x86_64                                                 7.4.28-1.el8.remi                                  @remi-modular        
php-xml.x86_64                                                    7.4.28-1.el8.remi                                  @remi-modular        
php-xmlrpc.x86_64                                                 7.4.28-1.el8.remi                                  @remi-modular        
php74.x86_64                                                      1.0-3.el8.remi                                     @remi-safe           
php74-libzip.x86_64                                               1.8.0-1.el8.remi                                   @remi-safe           
php74-php-cli.x86_64                                              7.4.28-1.el8.remi                                  @remi-safe           
php74-php-common.x86_64                                           7.4.28-1.el8.remi                                  @remi-safe           
php74-php-fpm.x86_64                                              7.4.28-1.el8.remi                                  @remi-safe           
php74-php-gd.x86_64                                               7.4.28-1.el8.remi                                  @remi-safe           
php74-php-intl.x86_64                                             7.4.28-1.el8.remi                                  @remi-safe           
php74-php-json.x86_64                                             7.4.28-1.el8.remi                                  @remi-safe           
php74-php-mbstring.x86_64                                         7.4.28-1.el8.remi                                  @remi-safe           
php74-php-mysqlnd.x86_64                                          7.4.28-1.el8.remi                                  @remi-safe           
php74-php-opcache.x86_64                                          7.4.28-1.el8.remi                                  @remi-safe           
php74-php-pdo.x86_64                                              7.4.28-1.el8.remi                                  @remi-safe           
php74-php-pecl-igbinary.x86_64                                    3.2.7-1.el8.remi                                   @remi-safe           
php74-php-pecl-imagick-im6.x86_64                                 3.7.0-1.el8.remi                                   @remi-safe           
php74-php-pecl-msgpack.x86_64                                     2.1.2-1.el8.remi                                   @remi-safe           
php74-php-pecl-redis5.x86_64                                      5.3.7-1.el8.remi                                   @remi-safe           
php74-php-pecl-varnish.x86_64                                     1.2.6-1.el8.remi                                   @remi-safe           
php74-php-pecl-zip.x86_64                                         1.20.0-1.el8.remi                                  @remi-safe           
php74-php-soap.x86_64                                             7.4.28-1.el8.remi                                  @remi-safe           
php74-php-xml.x86_64                                              7.4.28-1.el8.remi                                  @remi-safe           
php74-runtime.x86_64                                              1.0-3.el8.remi                                     @remi-safe           
wbm-php-pear.noarch                                               2:1.6-1                                            @virtualmin-universal

Did I delete some default packages? As far as I remember, I do not delete any packages, but my memory may not serve me right.

AFAIK, I just try to install redis, varnish, and remi for installing other php version, wpcli and telegraf.
Caching software are not used yet, just installed and let service running without any method from wordpress to interact with those softwares. Telegraf is currently disabled due to influxdb server on another vps not stable enough to receive datas from multiple server.

It seems that all issues in your case are caused by installing mod_php which you shouldn’t do!

Start from removing these packages:

dnf remove php php74

Then restart Nginx and re-check config. Afterwards, go to PHP Options page and change execution mode to FPM.

Thank you! This is solving my issue, and likely issues on other server that I installed all with dnf install php74 which in the end prevent me to use PHP FPM.

PHP mbstring and imagick is now detected.

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.