15

I am checking for my php version using

php -v

command in console and I am getting a WARNING below

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php_mbstring.dll' - /usr/lib/php/20151012/php_mbstring.dll: cannot open shared object file: No such file or directory in Unknown on line 0 PHP 7.0.4-7ubuntu2 (cli) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

I have uncommented this line extension=php_mbstring.dll in my /etc/php/7.0/fpm/php.ini file and this doesn't seem to solve my problem. How would i get rid of this warning?

3
  • php_mbstring.dll is for Windows. On Linux it's called mbstring.so
    – NikiC
    Commented Apr 30, 2016 at 10:55
  • 1
    I agree with what you are saying. Question is why would a windows error show in ubuntu and how can I install the mbstring.so library?
    – jaahvicky
    Commented Apr 30, 2016 at 10:58
  • sir @jaahvicky I have the same problem.Are you have the key?please share if.
    – Raham
    Commented Feb 13, 2017 at 8:20

4 Answers 4

12

In php.ini search "extension_dir" : uncomment for the platform (in my case it is on Windows:)

; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
extension_dir = "ext"
8

I was running into the same PHP warnings when trying to run it from the command line. This was on a Homestead Vagrant Ubuntu box, where i was getting:

 PHP Warning:  PHP Startup: Unable to load dynamic library 
'/usr/lib/php/20160303/php_mbstring.dll' - 
/usr/lib/php/20160303/php_mbstring.dll: cannot open shared object file: No 
such file or directory in Unknown on line 0

PHP Warning:  PHP Startup: Unable to load dynamic library 
'/usr/lib/php/20160303/php_exif.dll' - /usr/lib/php/20160303/php_exif.dll: 
cannot open shared object file: No such file or directory in Unknown on line 0

What I didn't realize is that it uses a php.ini in a separate /cli/ directory (E.g. /etc/php/7.X/cli/php.ini) when you're running php on the command line or using a CLI that uses PHP

Based on the paths in your question, look for /etc/php/7.0/cli/php.ini and you should comment out the mbstring module (assuming Linux):

extension=php_mbstring.dll
;extension=php_mbstring.dll ; commented out

If this doesn't solve the issue for you, try running:

php -i | grep -i "Loaded Configuration File"

This pointed me at the correct php.ini file:

Loaded Configuration File => /etc/php/7.1/cli/php.ini
0

This issue regarding PHP extension, you need to enable mbstring extension in php.ini file.

File Path: /etc/php/7.1/cli/php.ini

Line no around 903.

There will be

;extension=php_mbstring.dll

It should be

extension=php_mbstring.dll

1
  • in modern PHP (tested with 8.2.0) all extension are listed in php.ini in a platform-independent manner like extension=mbstring or extension=openssl, and the engine is smart enough to find them if the location is specified (like extension_dir = "ext" for Windows or extension_dir = "./" for Linux)
    – AntonK
    Commented Dec 14, 2022 at 15:25
-2

I had the same problem. But in my case, the problem was the because of open server. After I run the open server, everything is going well!

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.