Ishan Shah
Ishan Shah

Reputation: 1676

PHP Warning: PHP Startup: Unable to load dynamic library

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.

Upvotes: 0

Views: 7106

Answers (1)

Shi
Shi

Reputation: 4258

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).

Upvotes: 1

Related Questions