Wrapper not supporting UTF-8

Hi everybody :slight_smile:
We installed new Apache2 server and PHP8.
When we try to access to our homepage, we have this fatal error :
**Fatal error**: Uncaught Laminas\Stdlib\Exception\RuntimeException: No wrapper found supporting "UTF-8" in [...]/vendor/laminas/laminas-stdlib/src/StringUtils.php:161

We tried to check if something is missing (for ex AddDefaultCharset UTF-8 in vhost files, …) but we don’t have any idea why this error occures…
Also tried to clean vendor and re-install libraries…
Maybe an extension is missing (or wrong one) ? I saw we should have iconv or mbstring, but we have them :
[PHP Modules] : bcmath, calendar, Core, ctype, curl, date, dom, exif, FFI, fileinfo, filter, ftp, gd, gettext, hash, iconv, intl, json, libxml, mbstring, mysqli, mysqlnd, openssl, pcntl, pcre, PDO, pdo_mysql, Phar, posix, readline, Reflection, session, shmop, SimpleXML, sockets, sodium, SPL, standard, sysvmsg, sysvsem, sysvshm, tokenizer, xml, xmlreader, xmlwriter, xsl, Zend OPcache, zlib

Any idea ? :slight_smile:

Hey @Issinia, welcome!

laminas-stdlib requires one of these extensions intl, iconv, or mbstring to properly work with multibyte strings.

You mentioned that these extensions are already installed, so my guess is they may not be enabled or configured correctly.

You can use this script to check.

<?php

$required_extensions = array_merge(...array_map(function(string $extension): array {
    return [$extension => extension_loaded($extension) ? 'true' : 'false'];
}, ['intl','iconv','mbstring']));

print_r([
    'required' => $required_extensions,
    'installed' => get_loaded_extensions()
]);

I recommend:

  1. Try to re-install the extensions using this command and then restart apache.

    sudo apt-get install php8.0-mbstring  php8.0-intl  php8.0-iconv
    
    sudo service apache2 restart
    
  2. If the extension is already installed you should try to enable it. Either in the php.ini file or from command line.

    phpenmod -v 8.0 -s apache2 iconv
    
    phpenmod -v 8.0 -s apache2 intl
    
    phpenmod -v 8.0 -s apache2 mbstring
    

Resource: How to Enable/Disable PHP Modules on Ubuntu - TecAdmin

Have a great weekend. :v:t6:

Hi !

First of all, thanks for your answer @ghostwriter :slight_smile:
I tried to run all your command without any new good new :frowning: I also tried to remove the 3 extensions and install them again.
So I removed them, installed them and also try to enable them.
With the php script, here what I get :
Array ( [required] => Array ( [intl] => false [iconv] => false [mbstring] => false ) [installed] => Array ( [0] => Core [1] => date [2] => libxml [3] => openssl [4] => pcre [5] => zlib [6] => filter [7] => hash [8] => json [9] => Reflection [10] => SPL [11] => session [12] => standard [13] => sodium [14] => apache2handler ) )
It looks they are installed, but why do they have a “false” status, is that correct ?

One additionnal question :
When I run the php -m command, I get approx 40 extensions, but with the php script, I found only 3 required and 15 installed. Is that correct ?
They are installed but not loaded ?

Thanks again for your support

I finally re-installed most of extensions and I also saw an error into the php.ini file…

I can fo further now…

Thanks for support

Hey @Issinia :wave:t6:,

Hope you had a great weekend.

Looking at the result of the script, It looks like PHP did not load the extensions.

Let’s try adding Ondřej Surý’s PPA repositories and reinstalling PHP 8.0

sudo apt update
sudo apt install lsb-release ca-certificates apt-transport-https software-properties-common -y
sudo add-apt-repository ppa:ondrej/php
sudo add-apt-repository ppa:ondrej/apache2
sudo apt update
sudo apt install php8.0

Install extensions

sudo apt install php8.0-<extension>

Some available extensions are as shown below:

php8.0-amqp
php8.0-apcu
php8.0-ast
php8.0-bcmath
php8.0-bz2
php8.0-cgi
php8.0-cli
php8.0-common
php8.0-curl
php8.0-dba
php8.0-decimal
php8.0-dev
php8.0-ds
php8.0-enchant
php8.0-fpm
php8.0-gd
php8.0-gearman
php8.0-gmagick
php8.0-gmp
php8.0-gnupg
php8.0-grpc
php8.0-igbinary
php8.0-imagick
php8.0-imap
php8.0-inotify
php8.0-interbase
php8.0-intl
php8.0-ldap
php8.0-lz4
php8.0-mailparse
php8.0-maxminddb
php8.0-mbstring
php8.0-mcrypt
php8.0-memcache
php8.0-memcached
php8.0-mongodb
php8.0-msgpack
php8.0-mysql
php8.0-oauth
php8.0-odbc
php8.0-opcache
php8.0-pcov
php8.0-pgsql
php8.0-phpdbg
php8.0-protobuf
php8.0-ps
php8.0-pspell
php8.0-psr
php8.0-raphf
php8.0-readline
php8.0-redis
php8.0-rrd
php8.0-smbclient
php8.0-snmp
php8.0-soap
php8.0-solr
php8.0-sqlite3
php8.0-ssh2
php8.0-swoole
php8.0-sybase
php8.0-tidy
php8.0-uopz
php8.0-uploadprogress
php8.0-uuid
php8.0-vips
php8.0-xdebug
php8.0-xhprof
php8.0-xml
php8.0-xmlrpc
php8.0-xsl
php8.0-yac
php8.0-yaml
php8.0-zip
php8.0-zmq
php8.0-zstd

Restart Apache2

sudo service apache2 restart

Then try running the PHP script from my last comment again. If you run into any issues, don’t worry, we’ll figure it out together.

Resources:

Have a great day.

Thanks !
It seems it was because the extension path in php.ini was wrong…
Now it seems this problem is solved…

I will probably open a new thread for the next error :sweat_smile:

Thanks for your support @ghostwriter