Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't get mbstring to work on Amazon linux 2 AMI

I run on Amazon linux 2 AMI, With PHP 7.2.5 and apache

The probleme is: Call to undefined function mb_convert_encoding

The initial need is to be able to read an uploaded text file correctly and have its content inserted in DB, knowing that the encodings can be various

The problem i am struggling with is to get mb_convert_encoding working !

i tried:

sudo yum install php-mbstring
sudo yum install php7.2-mbstring

and all the possible variations and php versions, with a sudo service httpd restart between each attempt, nothing get the function to work.

Any suggestion ? Thanks a lot

like image 738
Jay Cohen Avatar asked Nov 28 '22 22:11

Jay Cohen


2 Answers

I had the same issue, strangely when I reboot the instances it did enabled.

First installed mbstring using this command:

sudo yum install php-mbstring

Then reboot

sudo shutdown -r now

I don't know why restarting httpd not enough, but its work for me, hopefully will work for you.

like image 99
Mansour Avatar answered Dec 06 '22 04:12

Mansour


I ran into the same issue where php exposed via apache httpd would not reflect the updated packages. I could resolve the issue with

service php-fpm restart

and avoid the system restart

like image 21
rudpot Avatar answered Dec 06 '22 04:12

rudpot