'centos+enabling mbstring extension in php.ini still not showing in phpinfo()

I am using CentOS distro and I tried enabling mbstring in my php.ini.

My php.ini is located at /usr/local/lib/php.ini and I tried enabling mbstring there.

Here's the screenshot: enter image description here

When I visit my phpinfo() page, the mbstring is still not enabled.

I already restarted apache too, this is my command service httpd restart but still not working.

What seems to be the problem here?

Your help will be greatly appreciated!

Thank you!



Solution 1:[1]

You are using CentOs so the extensions extension is .so. In the above example, you are enabling windows DLL's.

Try uncomment or add extension=php_mbstring.so.

Solution 2:[2]

  1. First install mbstring
sudo yum install php-mbstring
  1. check if the mbstring is appearing in php -m | grep mbstring

  2. check the extension directory in phpinfo in my case it was /usr/lib64/php/modules/

  3. httpd/appache is looking for extensions in /etc/httpd/modules
    In my case, I copied the file

$ cp /usr/lib64/php/modules/mbstring.so /etc/httpd/modules/mbstring.so
  1. sudo service httpd restart

Note then if you are using AWS EC2 try to stop and start the server to reload the new modules it works for me just after stopping and starting EC2

  1. [optional] last in php.ini put
[mbstring]
mbstring.language = all
mbstring.internal_encoding = UTF-8
mbstring.http_input = auto
mbstring.http_output = UTF-8
mbstring.encoding_translation = On
mbstring.detect_order = UTF-8
mbstring.substitute_character = none;
mbstring.func_overload = 0
mbstring.strict_encoding = Off

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ismail RBOUH
Solution 2