Call to undefined function Symfony\Polyfill\Mbstring\iconv_strlen()

SlimenTN picture SlimenTN · Nov 25, 2016 · Viewed 29.5k times · Source

My project works fine on localhost but not working online and this is the error:

Fatal error: Call to undefined function Symfony\Polyfill\Mbstring\iconv_strlen() in /home/stram/public_html/vendor/symfony/polyfill-mbstring/Mbstring.php on line 338

I googled it and I found that I need to install the PHP extension iconv. The problem that I'm using a VPS and when I went to the list of available PHP extensions I didn't found this extension !

enter image description here
enter image description here
enter image description here

Thnx in advance.

Answer

Michael Hirschler picture Michael Hirschler · Nov 25, 2016

Symfony provides an iconv-polyfill for cases like that. Just add it as requirement to your project, and you should be fine:

composer require symfony/polyfill-iconv