Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 681
SlimenTN Avatar asked Nov 25 '16 08:11

SlimenTN


3 Answers

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
like image 141
Michael Hirschler Avatar answered Nov 21 '22 09:11

Michael Hirschler


It may also happen that you are using an outdated version of PHP, or one that was compiled without iconv.

To check that, run php --ri iconv with any SSH software, like Putty, etc.

If it shows Extension 'iconv' not present., your problem is in PHP. Then you have a few options:

  • Run php -v to check your PHP version, and update it if necessary
  • Or compile PHP again with iconv
  • Or enable iconv on WHM/cPanel, if you use them
  • Or ask your hosting company for support
like image 43
Lucas Bustamante Avatar answered Nov 21 '22 07:11

Lucas Bustamante


Here is a solution to your problem (command line is for CentOS) :

EasyApache

like image 22
yasin Avatar answered Nov 21 '22 07:11

yasin