Search code examples
phpsymfonyvpsiconv

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


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.


Solution

  • 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