0

When i run

php -v

Got an error like

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

And tried the solution with install mbstring like

sudo apt-get install php-mbstring

after that tried with enable it like:

sudo phpdismod mbstring # disable mbstring extension
sudo phpenmod mbstring # enable mbstring extension again

But enable to find the solution also tried with php.ini.

6
  • How many installation of php are there on your system check in /etc/ Commented Apr 20, 2017 at 8:52
  • There is two folder php5 and php. in php there is 3 different folder 5.6,7.0,7.1 @MASIDDIQUI Commented Apr 20, 2017 at 8:55
  • Thats creating the problem ... In one environment its better to install one php, so you may think of removing 5.6, 7.0 Commented Apr 20, 2017 at 9:02
  • @MASIDDIQUI but when i run phpnfo() at that time it shows 5.6 and when run php -v then it shows 7.1.x Commented Apr 20, 2017 at 9:04
  • To install mbstring in php5.6 you need to do is sudo apt-get install php5-mbstring and then try Commented Apr 20, 2017 at 9:06

1 Answer 1

1

It seems as if you have multiple versions of PHP installed. It also is likely that all those versions of PHP refer to the very same configuration file (php.ini). This configuration file then loads extensions which are available just for some of the PHP installations but not for all.

Furthermore, it seems as if you use a different version of PHP from command line than for your web server.

  • If you run php -i from command line, you get information about default PHP CLI (command line interface) installation.
  • If you add a file phpinfo.php with <?php phpinfo(); ?> somewhere in your htdocs (web server) directory, you see the default PHP version for the web.

Even more strange is that you are trying to load a Windows extension php_mbstring.dll even though you seem to be on Linux.

You should check for each installed PHP which configuration file it uses. The information is part of the output of php -i or phpinfo(). Make sure different versions of PHP use different configuration files.

Check where the DLL file is loaded from via grep -iRn 'php_mbstring.dll' /etc. Remove this line or change it to the Linux extension (likely extension=mbstring.so).

Sign up to request clarification or add additional context in comments.

1 Comment

My issue was the same but with php_openssl.dll I used php -i to see where my configuration php.ini was located. In there found that the line extension=php_openssl.dll was uncommented. .dll files are for Windows environments so won't be found on Linux

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.