5

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

Jay Cohen
  • 193
  • 2
  • 9

3 Answers3

17

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.

Mansour
  • 194
  • 1
  • 4
  • You kid me not, the reboot solution also worked for me. I was mind blown as to why a reboot is needed. – Abel Callejo Dec 18 '19 at 08:49
  • Thank you very much. I've been searching for this and this exactly was my problem. Restarting EC2 instance fixed it. – Marwa Eldawy Jan 22 '20 at 20:30
  • There is no need to shut down the machine. Only need to restart the affected services. If restarting the apache service doesn't work, it's most likely the php-fpm service. – Ultimater Jun 22 '23 at 07:52
10

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

rudpot
  • 101
  • 1
  • 4
0

The correct package for PHP7.2 is:

sudo yum install php72-mbstring

Then a simple HTTPD service restart applies the update:

sudo service httpd restart
Stan S.
  • 91
  • 1
  • 5