Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/msqli.so'

Tags:

php

mysql

Looked at all the articles on search for this and no answers that work -- on Ubuntu 16.04 I'm getting:

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

msqli.so is definitely there in the folder cited above and is owned by root and is excutable. Folder and parent folders are owned by root. Hell of it is, phpmyadmin is running fine and can see and operate on the mySQL databases just fine. Do I need to chown folders/files to mysql or php entities? Just reinstalled Apache/php/mysql today and that did not fix it - all latest versions. Trying to use Eclipse IDE but this code fails on web server, too. Also tried in php.ini extensions pdo_msql.so and msqlnd.so and related coding techniques, but they all resulted in messages like the above (but with appropriate .so filename) so I suspect its 'environmental' something wrong in setup. phpinfo(); suggests the drivers are all there and working.

like image 402
Ron Robinson Avatar asked May 29 '26 11:05

Ron Robinson


2 Answers

It seems that uninstalling all versions of php with

sudo apt-get purge `dpkg -l | grep php | awk '{print $2}' | tr "\n" " "`

and only installing the latest version with

apt install php libapache2-mod-php php-mysql php-xml php-soap php-gd php-mbstring

solved the problem for me.

like image 131
Igor Skoric Avatar answered Jun 01 '26 02:06

Igor Skoric


Solved it with help from this post.

Changed php.ini:

extension=/usr/lib/php/20151012/mysqli.so
extension=/usr/lib/php/20151012/mysqlnd.so

to

extension=/usr/lib/php/20151012/mysqlnd.so
extension=/usr/lib/php/20151012/mysqli.so

ie: reversed the order of the 2 entries to put mysqlnd.so first.

Now I am all happy and telecomputing with alacrity and enthusiasm.

like image 44
Ron Robinson Avatar answered Jun 01 '26 00:06

Ron Robinson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!