Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Startup Unable to load dynamic library /usr/lib/php/20151012/php_mysqli.dll

I have ubuntu 14.04 EC2 instance. I have installed php 7 on it. when I execute any php command like php --version or any other. I get following error

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

I have tried following

  1. enable php_mysqli.dll in php.ini
  2. enable mysqli.so
  3. enable php_mysqli.so
  4. sudo apt-get install php-mysql

but nothing worked for me.

Any suggestion how I can solve this?

like image 691
Jass Avatar asked Aug 29 '16 11:08

Jass


4 Answers

If you are on Linux, you shouldn't have DLL files but SO files. So first, you have to remove / disable the php_mysqli.dll you added in php.ini.

In order to use mysqli, you should then :

  • install the package for Ubuntu : apt-get install php-mysql
  • check if it is already enabled (with phpinfo() for example)
  • if not enabled, enable the module - check in /etc/php/mods-available/ folder if there is a mysqli.ini, containing extension=mysqli.so, then check for CLI / FPM / Apache / other if there is the symbolic link pointing to this file (for example for CLI, in /etc/php/cli/conf.d/ : 20-mysqli.ini -> ../../mods-available/mysqli.ini)
  • restart php / apache / nginx depending what you are using
like image 77
jquiaios Avatar answered Nov 21 '22 19:11

jquiaios


In my case, it happened because I uncommented the extension=php_mysqli.dll line in php.ini file for running some other package. After Googling around I found that you should not uncomment anything directly from php.ini instead you should install the required PHP extension and it will do the rest.

like image 38
Nilkamal Gotarne Avatar answered Nov 21 '22 21:11

Nilkamal Gotarne


I have recently encountered this problem on ubuntu16.04, I finally resolve it by adding a semi-colon at each line like extension=php_*.dll,I think that is because LAMP on ubuntu is intelligent enough,it automatically opens all of the extensions for us. And on windows,we have to enable the extensions manually by remove the semi-colon at each line like ;extension=php_*.dll in php.ini.

like image 24
skiwer Avatar answered Nov 21 '22 21:11

skiwer


Run Phpinfo() Search for your php.ini path

search extension=php_mysqli.so

comment like this

;extension=php_mysqli.so
like image 37
Babu Pandey Avatar answered Nov 21 '22 19:11

Babu Pandey