Unable to load dynamic library - php

I get this warning message in my php:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/sqlite.so' - /usr/lib64/php/modules/sqlite.so: cannot open shared object file: No such file or directory in Unknown on line 0
How should I fix that? Where can I get this sqlite.so file?

You don't need to get it. Just remove the line referencing the shared object.
cd /etc/php5
grep -rinH sqlite .
Since PHP 5.4 sqlite is only available via PECL.
If you want to get the library, try sudo apt-get install php-sqlite or yum install php-sqlite or similar.

Two ideas: (Re-) install php-sqlite on your machine or remove the line which loads the sqlite.so. Mostly done by an extra config in /etc/php5/conf.d/
If you don't have shell access, call you system administrator and give him that error message.

The .so file was removed in Ubuntu 11.10 (bug report here), however you can still install it manually...
Download the old package: http://packages.ubuntu.com/natty-updates/php5-sqlite
Extracts sqlite.so to the required directory
Change it's ownership to root:root

you must have sure sqlite installed
goto /etc/php.d and find sqlite.ini
you must somethong like : extension=mysql.so
mysql.so must be in : /usr/lib64/php/modules/
if not you must install it

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php54/5.4.30/lib/php/extensions/no-debug-non-zts-20100525/redis.so' - dlopen(/usr/local/Cellar/php54/5.4.30/lib/php/extensions/no-debug-non-zts-20100525/redis.so, 9): image not found in Unknown on line 0
Warning: PHP Startup: Unable to load dynamic library '/usr/local/Cellar/php54/5.4.30/lib/php/extensions/no-debug-non-zts-20100525/redis.so' - dlopen(/usr/local/Cellar/php54/5.4.30/lib/php/extensions/no-debug-non-zts-20100525/redis.so, 9): image not found in Unknown on line 0
I was getting this error/warning resolved it by uninstalling and installing redis
brew uninstall php54-redis
brew install php54-redis

I had the same warning when I wanted to install the symfony/security-bundle bundle in my Symfony 4 project:
composer require symfony/security-bundle
Here the warning:
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_sqlite' (tried: /usr/lib/php/modules/pdo_sqlite (/usr/lib/php/modules/pdo_sqlite: cannot open shared object file: No such file or directory), /usr/lib/php/modules/pdo_sqlite.so (/usr/lib/php/modules/pdo_sqlite.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
I checked my /etc/php/php.ini file and I uncommented the line extension=pdo_sqlite line. I had to install the package php-sqlite via my package manager because the file pdo_sqlite.so must be present in the /usr/lib/php/modules/ folder:
pacman -S php-sqlite
After, I typed again the composer command and the warning disappeared. I hope my answer can help you.

Related

PHP Startup: Unable to load dynamic library 'pdo_mysql' in linux mint 20.2 PHP8 [duplicate]

root#ip-10-131-9-200:/etc/php5/apache2# php -a
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/curl.so' - /usr/lib/php5/20090626+lfs/curl.so: 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/php5/20090626+lfs/mcrypt.so' - /usr/lib/php5/20090626+lfs/mcrypt.so: 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/php5/20090626+lfs/mysql.so' - /usr/lib/php5/20090626+lfs/mysql.so: 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/php5/20090626+lfs/mysqli.so' - /usr/lib/php5/20090626+lfs/mysqli.so: 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/php5/20090626+lfs/pdo.so' - /usr/lib/php5/20090626+lfs/pdo.so: 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/php5/20090626+lfs/pdo_mysql.so' - /usr/lib/php5/20090626+lfs/pdo_mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
Interactive shell
Even though several other answers suggest it, installing more unnecessary software is generally not the best solution. Instead, you should fix the underlying problem. The reason these messages appear is because you are trying to load those extensions, but they are not installed. So the easy solution is simply to tell PHP to stop trying to load them:
First, find out which files are trying to load the above extensions:
$ grep -Hrv ";" /etc/php5 | grep -E "extension(\s+)?="
Example output for Ubuntu:
/etc/php5/mods-available/gd.ini:extension=gd.so
/etc/php5/mods-available/pdo_sqlite.ini:extension=pdo_sqlite.so
/etc/php5/mods-available/pdo.ini:extension=pdo.so
/etc/php5/mods-available/pdo_mysql.ini:extension=pdo_mysql.so
/etc/php5/mods-available/mysqli.ini:extension=mysqli.so
/etc/php5/mods-available/mysql.ini:extension=mysql.so
/etc/php5/mods-available/curl.ini:extension=curl.so
/etc/php5/mods-available/sqlite3.ini:extension=sqlite3.so
/etc/php5/conf.d/mcrypt.ini:extension=mcrypt.so
/etc/php5/conf.d/imagick.ini:extension=imagick.so
/etc/php5/apache2/php.ini:extension=http.so
Now just find the files that are loading the extensions that are causing the errors and comment out those lines with a ;. For some reason this happened to me with the default install of Ubuntu, so hopefully this helps someone else.
sudo apt-get install php5-mcrypt
sudo apt-get install php5-mysql
...etc resolved it for me :)
hope it helps
Look /etc/php5/cli/conf.d/ and delete corresponding *.ini files. This error happens when you remove some php packages not so cleanly.
Seems like you upgraded PHP to newer version and old .ini files are still pointing to old location.
The solution: find out where are modules located now
ls -l /usr/lib/php5
There should be a directory similar to old 20090626. In my case it is now 20131226
The .ini files giving you an error are located at /etc/php5/cli/conf.d/
Just edit those .ini files which module gives you an error. For example, in case the error is for mcrypt module:
sudo vi /etc/php5/cli/conf.d/20-mcrypt.ini
Change the line:
extension=/usr/lib/php5/20090626/mcrypt.so
to reflect the new path for .so file. In my case the correct path should be:
extension=/usr/lib/php5/20131226/mcrypt.so
That's it! The error is gone. Ofc you'd have to do it with each module giving you an error.
If you put the ; symbol, this action inactive the extension.
I had the same problem and did the following:
Uninstall php with purge parameter:
sudo apt-get --purge remove php5-common
And install again:
sudo apt-get install php5 php5-mysql
My problem was solved by the following command
sudo apt-get install php5-mcrypt
I have
PHP 5.3.10-1ubuntu3.4 with Suhosin-Patch (cli)
Ubuntu Desktop 12.04
Mysql 5.5
I found this solution by blog.tordeu.com, and it's
sudo aptitude purge php5-suhosin
I'm not sure, but it seems that the suhosin is no longer needed, it worked for my, my PHP version:
PHP 5.4.34-1+deb.sury.org~lucid+1 (cli) (built: Oct 17 2014 15:26:51)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
If you are using 5.6 php,
sudo apt-get install php5.6-curl
Somehow the gmp.so file seems to have been deleted from my system. This is what fixed it for me:
sudo apt-get install --reinstall php5-gmp
Well for Ubuntu 14.04 I was getting that error just for mcrypt:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212/mcrypt.ini' - /usr/lib/php5/20121212/mcrypt.ini: cannot open shared object file: No such file or directory in Unknown on line 0
If you have a closer look at the error, php is looking for mcrypt.ini and not for mcrypt.so at that location. I just copy mcrypt.so to mcrypt.ini and that's it, the warning is gone and the extension now is properly installed. It might look a bit dirty but it worked!
I had enabled the extension_dir in php.ini by uncommenting,
extension_dir = "ext"
extension=phpchartdir550.dll
and copying phpchartdir550 dll to the extension_dir (/usr/lib/php5/20121212), resulted in the same error.
PHP Warning: PHP Startup: Unable to load dynamic library 'ext/phpchartdir550.dll' - ext/phpchartdir550.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 'ext/pdo.so' - ext/pdo.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'ext/gd.so' - ext/gd.so: cannot open shared object file: No such file or directory in Unknown on line 0
As #Mike pointed out, it is not necessary to install all the stuff when they are not actually required in the application.
The easier way is to provide the full path to the extensions to be loaded after copying the libraries to the correct location.
Copy phpchartdir550.dll to /usr/lib/php5/20121212, which is the extension_dir in my Ubuntu 14.04 (this can be seen using phpinfo())
and then provide full path to the library in php.ini,
; extension=/path/to/extension/msql.so
extension=/usr/lib/php5/20121212/phpchartdir550.dll
restart apache: sudo service apache2 restart
even though other .so's are present in the same directory, only the required ones can be selectively loaded.
I had a similar problem, which led me here:
$ phpunit --version
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20131226/profiler.so' - /usr/lib/php5/20131226/profiler.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHPUnit 5.7.17 by Sebastian Bergmann and contributors.
Unlike the above, installing the software did not resolve my problem because I already had it.
$ sudo apt-get install php5-uprofiler
Reading package lists... Done
Building dependency tree
Reading state information... Done
php5-uprofiler is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 52 not upgraded.
I found my solution via : Debian Bug report logs
$ sudo vim /etc/php5/mods-available/uprofiler.ini
I edited the ini file, changing extension=profiler.so to extension=uprofiler.so .... the result, happily:
$ phpunit --version
PHPUnit 5.7.17 by Sebastian Bergmann and contributors.
i.e. no more warning.
(For Ubuntu users)
I had the same problem, but none of the answers above solved that. Here is how I solved the problem.
Open your php.ini file (mine was in /etc/php/7.3/cli/php.ini).
You may have something like this:
extension=pdo_mysql
Or maybe:
extension=/here/is/the/path/to/your/file/pdo_mysql.so
Add the following line before extension=pdo_mysql
extension=pdo
So, you will have:
extension=pdo
extension=pdo_mysql
It seems that the problem is (at least in my case) that we need to load pdo extension first to load the pdo_mysql extension.
Hope that helps!

Unable to load dynamic library 'pdo_mysql' [duplicate]

root#ip-10-131-9-200:/etc/php5/apache2# php -a
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/curl.so' - /usr/lib/php5/20090626+lfs/curl.so: 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/php5/20090626+lfs/mcrypt.so' - /usr/lib/php5/20090626+lfs/mcrypt.so: 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/php5/20090626+lfs/mysql.so' - /usr/lib/php5/20090626+lfs/mysql.so: 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/php5/20090626+lfs/mysqli.so' - /usr/lib/php5/20090626+lfs/mysqli.so: 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/php5/20090626+lfs/pdo.so' - /usr/lib/php5/20090626+lfs/pdo.so: 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/php5/20090626+lfs/pdo_mysql.so' - /usr/lib/php5/20090626+lfs/pdo_mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
Interactive shell
Even though several other answers suggest it, installing more unnecessary software is generally not the best solution. Instead, you should fix the underlying problem. The reason these messages appear is because you are trying to load those extensions, but they are not installed. So the easy solution is simply to tell PHP to stop trying to load them:
First, find out which files are trying to load the above extensions:
$ grep -Hrv ";" /etc/php5 | grep -E "extension(\s+)?="
Example output for Ubuntu:
/etc/php5/mods-available/gd.ini:extension=gd.so
/etc/php5/mods-available/pdo_sqlite.ini:extension=pdo_sqlite.so
/etc/php5/mods-available/pdo.ini:extension=pdo.so
/etc/php5/mods-available/pdo_mysql.ini:extension=pdo_mysql.so
/etc/php5/mods-available/mysqli.ini:extension=mysqli.so
/etc/php5/mods-available/mysql.ini:extension=mysql.so
/etc/php5/mods-available/curl.ini:extension=curl.so
/etc/php5/mods-available/sqlite3.ini:extension=sqlite3.so
/etc/php5/conf.d/mcrypt.ini:extension=mcrypt.so
/etc/php5/conf.d/imagick.ini:extension=imagick.so
/etc/php5/apache2/php.ini:extension=http.so
Now just find the files that are loading the extensions that are causing the errors and comment out those lines with a ;. For some reason this happened to me with the default install of Ubuntu, so hopefully this helps someone else.
sudo apt-get install php5-mcrypt
sudo apt-get install php5-mysql
...etc resolved it for me :)
hope it helps
Look /etc/php5/cli/conf.d/ and delete corresponding *.ini files. This error happens when you remove some php packages not so cleanly.
Seems like you upgraded PHP to newer version and old .ini files are still pointing to old location.
The solution: find out where are modules located now
ls -l /usr/lib/php5
There should be a directory similar to old 20090626. In my case it is now 20131226
The .ini files giving you an error are located at /etc/php5/cli/conf.d/
Just edit those .ini files which module gives you an error. For example, in case the error is for mcrypt module:
sudo vi /etc/php5/cli/conf.d/20-mcrypt.ini
Change the line:
extension=/usr/lib/php5/20090626/mcrypt.so
to reflect the new path for .so file. In my case the correct path should be:
extension=/usr/lib/php5/20131226/mcrypt.so
That's it! The error is gone. Ofc you'd have to do it with each module giving you an error.
If you put the ; symbol, this action inactive the extension.
I had the same problem and did the following:
Uninstall php with purge parameter:
sudo apt-get --purge remove php5-common
And install again:
sudo apt-get install php5 php5-mysql
My problem was solved by the following command
sudo apt-get install php5-mcrypt
I have
PHP 5.3.10-1ubuntu3.4 with Suhosin-Patch (cli)
Ubuntu Desktop 12.04
Mysql 5.5
I found this solution by blog.tordeu.com, and it's
sudo aptitude purge php5-suhosin
I'm not sure, but it seems that the suhosin is no longer needed, it worked for my, my PHP version:
PHP 5.4.34-1+deb.sury.org~lucid+1 (cli) (built: Oct 17 2014 15:26:51)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
If you are using 5.6 php,
sudo apt-get install php5.6-curl
Somehow the gmp.so file seems to have been deleted from my system. This is what fixed it for me:
sudo apt-get install --reinstall php5-gmp
Well for Ubuntu 14.04 I was getting that error just for mcrypt:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212/mcrypt.ini' - /usr/lib/php5/20121212/mcrypt.ini: cannot open shared object file: No such file or directory in Unknown on line 0
If you have a closer look at the error, php is looking for mcrypt.ini and not for mcrypt.so at that location. I just copy mcrypt.so to mcrypt.ini and that's it, the warning is gone and the extension now is properly installed. It might look a bit dirty but it worked!
I had enabled the extension_dir in php.ini by uncommenting,
extension_dir = "ext"
extension=phpchartdir550.dll
and copying phpchartdir550 dll to the extension_dir (/usr/lib/php5/20121212), resulted in the same error.
PHP Warning: PHP Startup: Unable to load dynamic library 'ext/phpchartdir550.dll' - ext/phpchartdir550.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 'ext/pdo.so' - ext/pdo.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'ext/gd.so' - ext/gd.so: cannot open shared object file: No such file or directory in Unknown on line 0
As #Mike pointed out, it is not necessary to install all the stuff when they are not actually required in the application.
The easier way is to provide the full path to the extensions to be loaded after copying the libraries to the correct location.
Copy phpchartdir550.dll to /usr/lib/php5/20121212, which is the extension_dir in my Ubuntu 14.04 (this can be seen using phpinfo())
and then provide full path to the library in php.ini,
; extension=/path/to/extension/msql.so
extension=/usr/lib/php5/20121212/phpchartdir550.dll
restart apache: sudo service apache2 restart
even though other .so's are present in the same directory, only the required ones can be selectively loaded.
I had a similar problem, which led me here:
$ phpunit --version
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20131226/profiler.so' - /usr/lib/php5/20131226/profiler.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHPUnit 5.7.17 by Sebastian Bergmann and contributors.
Unlike the above, installing the software did not resolve my problem because I already had it.
$ sudo apt-get install php5-uprofiler
Reading package lists... Done
Building dependency tree
Reading state information... Done
php5-uprofiler is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 52 not upgraded.
I found my solution via : Debian Bug report logs
$ sudo vim /etc/php5/mods-available/uprofiler.ini
I edited the ini file, changing extension=profiler.so to extension=uprofiler.so .... the result, happily:
$ phpunit --version
PHPUnit 5.7.17 by Sebastian Bergmann and contributors.
i.e. no more warning.
(For Ubuntu users)
I had the same problem, but none of the answers above solved that. Here is how I solved the problem.
Open your php.ini file (mine was in /etc/php/7.3/cli/php.ini).
You may have something like this:
extension=pdo_mysql
Or maybe:
extension=/here/is/the/path/to/your/file/pdo_mysql.so
Add the following line before extension=pdo_mysql
extension=pdo
So, you will have:
extension=pdo
extension=pdo_mysql
It seems that the problem is (at least in my case) that we need to load pdo extension first to load the pdo_mysql extension.
Hope that helps!

Why i am getting on Server

PHP Warning: PHP Startup: Unable to load dynamic library
'/usr/lib/php5/20121212/raphf.so' - /usr/lib/php5/20121212/raphf.so:
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/php5/20121212/propro.so' - /usr/lib/php5/20121212/propro.so:
cannot open shared object file: No such file or directory in Unknown on line 0
It's exactly saying what the error is. It can't open the libraries. Those libraries either dont exist in that folder or apache doesnt have the right to read them.
You need to install the propro and raph php extensions.
On Centos you'd do something like this
yum install php-raphf
yum install php-propro
For Ubuntu use apt-get
apt-get install php-raphf
apt-get install php-propro

Wordpress Installation PHP Error

THis is the update I get when I run the following command php -v
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/curl.so' - /usr/lib/php/modules/curl.so: 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/modules/dbase.so' - /usr/lib/php/modules/dbase.so: wrong ELF class: ELFCLASS32 in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/fileinfo.so' - /usr/lib/php/modules/fileinfo.so: 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/modules/json.so' - /usr/lib/php/modules/json.so: 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/modules/mysql.so' - /usr/lib/php/modules/mysql.so: wrong ELF class: ELFCLASS32 in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/mysqli.so' - /usr/lib/php/modules/mysqli.so: wrong ELF class: ELFCLASS32 in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/pdo.so' - /usr/lib/php/modules/pdo.so: 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/modules/pdo_mysql.so' - /usr/lib/php/modules/pdo_mysql.so: wrong ELF class: ELFCLASS32 in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/pdo_sqlite.so' - /usr/lib/php/modules/pdo_sqlite.so: 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/modules/phar.so' - /usr/lib/php/modules/phar.so: 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/modules/zip.so' - /usr/lib/php/modules/zip.so: cannot open shared object file: No such file or directory in Unknown on line 0
I'm trying to install Wordpress on a RHEL Machine. I initially had gotten mySQL up and running and then realized that my PHP was version 5.1.6. I added another repo, installed PHP 5.3 and removed the old php packages.
The error I get on a browser when I open localhost/wp-admin/install.php is:
Your PHP installation appears to be missing the MySQL extension which
is required by WordPress.
I have the package php-mysql.x86_64 installed and I can't figure out what the problem is.
I don't know what to do! Any help would be greatly appreciated.
Thanks.
Install required PHP libraries. RHEL installation command ( with all required modules for Wordpress):
sudo yum install php-bcmath php-cli php-common php-devel php-gd php-imap php-mbstring php-mcrypt php-mysqlnd php-odbc php-pdo php-pear php-pecl-geoip php-pecl-jsonc php-pecl-jsonc-devel php-pecl-zip php-pgsql php-process php-tidy php-xml php-xmlrpc
Install EPEL repos to update to latest PHP:
#CentOS 6 64Bit
sudo wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
sudo rpm -ivh epel-release-6-8.noarch.rpm
sudo yum update php
EPEL repos installation process for other versions - How to Enable EPEL Repository for RHEL/CentOS 7.x/6.x/5.x
EDIT 1:
In order to disable other repositories, see and edit .repo files in /etc/yum.repos.d/ directory and set enabled=1 to enabled=0. After all don't forget to run:
yum clean all
So, I figured this out. The latest php version was installed. I was using 64 Bit RHEL and the libraries were in the /usr/lib64 folder instead of the /usr/lib folder. Once I changed that bit in the php.ini file, it ran like a charm. :)

Error In PHP5 ..Unable to load dynamic library

root#ip-10-131-9-200:/etc/php5/apache2# php -a
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/curl.so' - /usr/lib/php5/20090626+lfs/curl.so: 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/php5/20090626+lfs/mcrypt.so' - /usr/lib/php5/20090626+lfs/mcrypt.so: 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/php5/20090626+lfs/mysql.so' - /usr/lib/php5/20090626+lfs/mysql.so: 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/php5/20090626+lfs/mysqli.so' - /usr/lib/php5/20090626+lfs/mysqli.so: 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/php5/20090626+lfs/pdo.so' - /usr/lib/php5/20090626+lfs/pdo.so: 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/php5/20090626+lfs/pdo_mysql.so' - /usr/lib/php5/20090626+lfs/pdo_mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0
Interactive shell
Even though several other answers suggest it, installing more unnecessary software is generally not the best solution. Instead, you should fix the underlying problem. The reason these messages appear is because you are trying to load those extensions, but they are not installed. So the easy solution is simply to tell PHP to stop trying to load them:
First, find out which files are trying to load the above extensions:
$ grep -Hrv ";" /etc/php5 | grep -E "extension(\s+)?="
Example output for Ubuntu:
/etc/php5/mods-available/gd.ini:extension=gd.so
/etc/php5/mods-available/pdo_sqlite.ini:extension=pdo_sqlite.so
/etc/php5/mods-available/pdo.ini:extension=pdo.so
/etc/php5/mods-available/pdo_mysql.ini:extension=pdo_mysql.so
/etc/php5/mods-available/mysqli.ini:extension=mysqli.so
/etc/php5/mods-available/mysql.ini:extension=mysql.so
/etc/php5/mods-available/curl.ini:extension=curl.so
/etc/php5/mods-available/sqlite3.ini:extension=sqlite3.so
/etc/php5/conf.d/mcrypt.ini:extension=mcrypt.so
/etc/php5/conf.d/imagick.ini:extension=imagick.so
/etc/php5/apache2/php.ini:extension=http.so
Now just find the files that are loading the extensions that are causing the errors and comment out those lines with a ;. For some reason this happened to me with the default install of Ubuntu, so hopefully this helps someone else.
sudo apt-get install php5-mcrypt
sudo apt-get install php5-mysql
...etc resolved it for me :)
hope it helps
Look /etc/php5/cli/conf.d/ and delete corresponding *.ini files. This error happens when you remove some php packages not so cleanly.
Seems like you upgraded PHP to newer version and old .ini files are still pointing to old location.
The solution: find out where are modules located now
ls -l /usr/lib/php5
There should be a directory similar to old 20090626. In my case it is now 20131226
The .ini files giving you an error are located at /etc/php5/cli/conf.d/
Just edit those .ini files which module gives you an error. For example, in case the error is for mcrypt module:
sudo vi /etc/php5/cli/conf.d/20-mcrypt.ini
Change the line:
extension=/usr/lib/php5/20090626/mcrypt.so
to reflect the new path for .so file. In my case the correct path should be:
extension=/usr/lib/php5/20131226/mcrypt.so
That's it! The error is gone. Ofc you'd have to do it with each module giving you an error.
If you put the ; symbol, this action inactive the extension.
I had the same problem and did the following:
Uninstall php with purge parameter:
sudo apt-get --purge remove php5-common
And install again:
sudo apt-get install php5 php5-mysql
My problem was solved by the following command
sudo apt-get install php5-mcrypt
I have
PHP 5.3.10-1ubuntu3.4 with Suhosin-Patch (cli)
Ubuntu Desktop 12.04
Mysql 5.5
I found this solution by blog.tordeu.com, and it's
sudo aptitude purge php5-suhosin
I'm not sure, but it seems that the suhosin is no longer needed, it worked for my, my PHP version:
PHP 5.4.34-1+deb.sury.org~lucid+1 (cli) (built: Oct 17 2014 15:26:51)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
If you are using 5.6 php,
sudo apt-get install php5.6-curl
Somehow the gmp.so file seems to have been deleted from my system. This is what fixed it for me:
sudo apt-get install --reinstall php5-gmp
Well for Ubuntu 14.04 I was getting that error just for mcrypt:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212/mcrypt.ini' - /usr/lib/php5/20121212/mcrypt.ini: cannot open shared object file: No such file or directory in Unknown on line 0
If you have a closer look at the error, php is looking for mcrypt.ini and not for mcrypt.so at that location. I just copy mcrypt.so to mcrypt.ini and that's it, the warning is gone and the extension now is properly installed. It might look a bit dirty but it worked!
I had enabled the extension_dir in php.ini by uncommenting,
extension_dir = "ext"
extension=phpchartdir550.dll
and copying phpchartdir550 dll to the extension_dir (/usr/lib/php5/20121212), resulted in the same error.
PHP Warning: PHP Startup: Unable to load dynamic library 'ext/phpchartdir550.dll' - ext/phpchartdir550.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 'ext/pdo.so' - ext/pdo.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'ext/gd.so' - ext/gd.so: cannot open shared object file: No such file or directory in Unknown on line 0
As #Mike pointed out, it is not necessary to install all the stuff when they are not actually required in the application.
The easier way is to provide the full path to the extensions to be loaded after copying the libraries to the correct location.
Copy phpchartdir550.dll to /usr/lib/php5/20121212, which is the extension_dir in my Ubuntu 14.04 (this can be seen using phpinfo())
and then provide full path to the library in php.ini,
; extension=/path/to/extension/msql.so
extension=/usr/lib/php5/20121212/phpchartdir550.dll
restart apache: sudo service apache2 restart
even though other .so's are present in the same directory, only the required ones can be selectively loaded.
I had a similar problem, which led me here:
$ phpunit --version
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20131226/profiler.so' - /usr/lib/php5/20131226/profiler.so: cannot open shared object file: No such file or directory in Unknown on line 0
PHPUnit 5.7.17 by Sebastian Bergmann and contributors.
Unlike the above, installing the software did not resolve my problem because I already had it.
$ sudo apt-get install php5-uprofiler
Reading package lists... Done
Building dependency tree
Reading state information... Done
php5-uprofiler is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 52 not upgraded.
I found my solution via : Debian Bug report logs
$ sudo vim /etc/php5/mods-available/uprofiler.ini
I edited the ini file, changing extension=profiler.so to extension=uprofiler.so .... the result, happily:
$ phpunit --version
PHPUnit 5.7.17 by Sebastian Bergmann and contributors.
i.e. no more warning.
(For Ubuntu users)
I had the same problem, but none of the answers above solved that. Here is how I solved the problem.
Open your php.ini file (mine was in /etc/php/7.3/cli/php.ini).
You may have something like this:
extension=pdo_mysql
Or maybe:
extension=/here/is/the/path/to/your/file/pdo_mysql.so
Add the following line before extension=pdo_mysql
extension=pdo
So, you will have:
extension=pdo
extension=pdo_mysql
It seems that the problem is (at least in my case) that we need to load pdo extension first to load the pdo_mysql extension.
Hope that helps!

Categories