Running a DigitalOcean droplet on Ubuntu (20.4?)
I have userA with root permission. They are also connected to userA within the postgres db.
Due to the setup for the software I'm using, they require a specific username for the postgresdb. Just so I'm not exposing too much data online, we'll call that userB. That's both a linux and postgres user.
I'm running a php command that basically takes (uname, dbname, pdo, options) as input, and it's currently failing bc it can't locate the pdo file.
I've looked through a few posts. One suggested to uncomment all of the pgsql and pdo_pgsql lines in all of the php.ini files, which i've done, both for production, development, and the generic version of that file.
When I run the command as both userA and userB I get this error.
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_pgsql' (tried: /usr/lib/php/20190902/pdo_pgsql (/usr/lib/php/20190902/pdo_pgsql: cannot open shared object file: No such file or directory), /usr/lib/php/20190902/pdo_pgsql.so (/usr/lib/php/20190902/pdo_pgsql.so: undefined symbol: pdo_parse_params)) in Unknown on line 0
However, pdo_pgsql.so actually does exist in that location. (is it looking for a file just named pdo_pgsql and is instead finding pdo_pgsql.so?)
The php site says to run a
./configure
command, but it doesn't really say which folder configure is in. It's not a package I can install from cli. (https://www.php.net/manual/en/ref.pdo-pgsql.php)
Other pages say you have to install autoconf first (https://unix.stackexchange.com/questions/158960/can-not-run-configure-command-no-such-file-or-directory) however that has not made ./configure an available command for me.
I've also found a post saying that a conf file in apache needs to be updated to show the location of the PDO file, however I'm not yet running a server, I'm just running a php file that populates a pgsql db locally. (pgsql extension is not loading)
Running
php -i | grep PDO
gives
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_pgsql' (tried: /usr/lib/php/20190902/pdo_pgsql (/usr/lib/php/20190902/pdo_pgsql: cannot open shared object file: No such file or directory), /usr/lib/php/20190902/pdo_pgsql.so (/usr/lib/php/20190902/pdo_pgsql.so: undefined symbol: pdo_parse_params)) in Unknown on line 0
PDO
PDO support => enabled
PDO drivers => pgsql
PDO Driver for PostgreSQL => enabled
Though according to customer service from the API it should be returning
PDO
PDO support => enabled
PDO drivers => mysql, odbc, pgsql
PDO Driver for MySQL => enabled
PDO Driver for ODBC (unixODBC) => enabled
PDO Driver for PostgreSQL => enabled
Though I think they're giving multiple examples of different drivers depending on your db software of choice.
I'm not exactly sure what to do.
Update:
I've tried editing the php.ini file that is being used by php via
php -i | grep ini
I used
locate pdo_pgsql
to find the pdo_pgsql and pdo_pgsql.so filepaths. I have tried 4 different edits to the php.ini file. 2 being uncommenting (one at a time) the default pgsql extensions. 2 being different filepaths to the pdo_pgsql files that are found on my system through locate.
**extension=/usr/lib/php/20190902/pdo_pgsql.so**
sudo php file.php
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20190902/pdo_pgsql.so' (tried: /usr/lib/php/20190902/pdo_pgsql.so (/usr/lib/php/20190902/pdo_pgsql.so: **undefined symbol: pdo_parse_params**), /usr/lib/php/20190902//usr/lib/php/20190902/pdo_pgsql.so.so (/usr/lib/php/20190902//usr/lib/php/20190902/pdo_pgsql.so.so: **cannot open shared object file: No such file or directory**)) in Unknown on line 0
**extension=/var/lib/php/modules/7.4/registry/pdo_pgsql**
sudo php file.php
PHP Warning: PHP Startup: Unable to load dynamic library '/var/lib/php/modules/7.4/registry/pdo_pgsql' (tried: /var/lib/php/modules/7.4/registry/pdo_pgsql (/var/lib/php/modules/7.4/registry/pdo_pgsql: **file too short**), /usr/lib/php/20190902//var/lib/php/modules/7.4/registry/pdo_pgsql.so (/usr/lib/php/20190902//var/lib/php/modules/7.4/registry/pdo_pgsql.so: **cannot open shared object file: No such file or directory)**) in Unknown on line 0
Could not open input file: file.php
**extension=pgsql**
sudo php file.php
**PHP Warning: Module 'pgsql' already loaded in Unknown on line 0**
Could not open input file: file.php
**extension=pdo_pgsql**
sudo php file.php
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_pgsql' (tried: /usr/lib/php/20190902/pdo_pgsql (/usr/lib/php/20190902/pdo_pgsql: **cannot open shared object file: No such file or directory**), /usr/lib/php/20190902/pdo_pgsql.so (/usr/lib/php/20190902/pdo_pgsql.so: **undefined symbol: pdo_parse_params**)) in Unknown on line 0
Could not open input file: file.php
output as requested by user below
$ php -v
PHP 7.4.3 (cli) (built: Mar 2 2022 15:36:52) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies
$ dpkg -l|grep pgsql
ii php-pgsql 2:7.4+75 all PostgreSQL module for PHP [default]
ii php7.4-pgsql 7.4.3-4ubuntu2.10 amd64 PostgreSQL module for PHP
$ dpkg -l|grep php
ii php-common 2:75 all Common files for PHP packages
ii php-pgsql 2:7.4+75 all PostgreSQL module for PHP [default]
ii php7.4-cli 7.4.3-4ubuntu2.10 amd64 command-line interpreter for the PHP scripting language
ii php7.4-common 7.4.3-4ubuntu2.10 amd64 documentation, examples and common module for PHP
ii php7.4-json 7.4.3-4ubuntu2.10 amd64 JSON module for PHP
ii php7.4-opcache 7.4.3-4ubuntu2.10 amd64 Zend OpCache module for PHP
ii php7.4-pgsql 7.4.3-4ubuntu2.10 amd64 PostgreSQL module for PHP
ii php7.4-readline 7.4.3-4ubuntu2.10 amd64
If something does not work on your DEV enc, do not TRY it on the PROD.. this beats the purpose of having a DEV env..
in php.ini you should already have an example on how to enable pgsql:
extension=pdo_pgsql
not module=
I do not see what is your PHP version, but make sure you install the appropriate version of php7.X-pgsql as it seems you have the wrong version of the library..
You can maybe add to your question the output of:
dpkg -l|grep pgsql
dpkg -l|grep php
php -v
Related
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!
I make some PHP applications and use PDO.
Everything is fine until I remove --purge PHP 7.2 and install PHP 7.4.
The program is running but says "could not find driver".
Install all modules like usual, and have error like this in Ubuntu :
Command:
#php -v
Result :
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_mysql.so' (tried: /usr/lib/php/20190902/pdo_mysql.so (/usr/lib/php/20190902/pdo_mysql.so: undefined symbol: mysqlnd_allocator), /usr/lib/php/20190902/pdo_mysql.so.so (/usr/lib/php/20190902/pdo_mysql.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 7.4.16 (cli) (built: Mar 5 2021 07:54:20) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.16, Copyright (c), by Zend Technologies
Command:
# php -i |grep PDO
Result :
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_mysql.so' (tried: /usr/lib/php/20190902/pdo_mysql.so (/usr/lib/php/20190902/pdo_mysql.so: undefined symbol: mysqlnd_allocator), /usr/lib/php/20190902/pdo_mysql.so.so (/usr/lib/php/20190902/pdo_mysql.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PDO
PDO support => enabled
PDO drivers => mysql, pgsql, sqlite
PDO Driver for MySQL => enabled
PDO Driver for PostgreSQL => enabled
PDO Driver for SQLite 3.x => enabled
In my info.php
Loaded Configuration File /etc/php/7.4/fpm/php.ini
In my terminal
Loaded Configuration File => /etc/php/7.4/cli/php.ini
So I edited in /etc/php/7.4/cli/php.ini.
Is I am wrong? Can someone give me a suggestion? Thanks.
I fixed this issue by making sure I had the package installed: sudo apt-get install php7.4-mysql
The real one is shown by info.php:
Loaded Configuration File /etc/php/7.4/fpm/php.ini
So, I finished the issue with configuring php.ini in fpm.
I have a local application with laravel 5.5 using a mysql databse on my ubuntu18.04.1. It is hosted on a server with php7.2, and I had the same version of php in my system. All was working fine. Yesterday, I tried to connect my app with SQL Server to get data from a database, and my nightmare started.
I added the data base connection info to the database.php file in my laravel app following this format
'sqlsrv' => [
'driver' => 'sqlsrv',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '1433'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'prefix' => '',
],
All seemed to be working fine, but when I tried to retrieve data, I had a connection exception, laravel was telling me that the sqlsrv driver wasn't found. I thought that, perhaps, the sqlsrv extension wasn't enabled, so I went to php.ini to activate it, but I didn't found it, so I started to investigate and I discovered that I had to install it from the microsoft webpage. I tried in all ways to add the proper .so, I installed and deinstalled php7.2 and I don't know how php7.4 folders and modules are on my system too. I followed this site (in spanish) to install a docker and try to prevent this situation in the future. I followed it till the $ sudo docker-compose up -d nginx mysql phpmyadmin part, then I tried to run my app and it works, it connects properly, but I cannot access to phpmyadmin via http://localhost:3030/, I have phpMyAdmin Error because it doesn't find the mysqli extension.
Then I tired to run php -S as I used to run when I trying to connect to phpMyAdmin and I get this
$ php -S localhost:3030
[Thu Dec 10 13:17:50 2020] PHP Warning: PHP Startup: Unable to load dynamic library 'mysqli' (tried: /usr/lib/php/20170718/mysqli (/usr/lib/php/20170718/mysqli: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/mysqli.so (/usr/lib/php/20170718/mysqli.so: undefined symbol: mysqlnd_global_stats)) in Unknown on line 0
[Thu Dec 10 13:17:50 2020] PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_mysql' (tried: /usr/lib/php/20170718/pdo_mysql (/usr/lib/php/20170718/pdo_mysql: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/pdo_mysql.so (/usr/lib/php/20170718/pdo_mysql.so: undefined symbol: mysqlnd_allocator)) in Unknown on line 0
[Thu Dec 10 13:17:50 2020] PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_sqlite' (tried: /usr/lib/php/20170718/pdo_sqlite (/usr/lib/php/20170718/pdo_sqlite: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/pdo_sqlite.so (/usr/lib/php/20170718/pdo_sqlite.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
[Thu Dec 10 13:17:50 2020] PHP Warning: PHP Startup: Unable to load dynamic library 'pgsql' (tried: /usr/lib/php/20170718/pgsql (/usr/lib/php/20170718/pgsql: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/pgsql.so (/usr/lib/php/20170718/pgsql.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
[Thu Dec 10 13:17:50 2020] Failed to listen on localhost:3030 (reason: Address already in use)
I ran php --ini to find where the configuration file is and edited the extension of mysqli to enable it, now when y run again php --ini I get this warns
$ php --ini
PHP Warning: PHP Startup: Unable to load dynamic library 'mysqli' (tried: /usr/lib/php/20170718/mysqli (/usr/lib/php/20170718/mysqli: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/mysqli.so (/usr/lib/php/20170718/mysqli.so: undefined symbol: mysqlnd_global_stats)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_mysql' (tried: /usr/lib/php/20170718/pdo_mysql (/usr/lib/php/20170718/pdo_mysql: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/pdo_mysql.so (/usr/lib/php/20170718/pdo_mysql.so: undefined symbol: mysqlnd_allocator)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_sqlite' (tried: /usr/lib/php/20170718/pdo_sqlite (/usr/lib/php/20170718/pdo_sqlite: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/pdo_sqlite.so (/usr/lib/php/20170718/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 'pgsql' (tried: /usr/lib/php/20170718/pgsql (/usr/lib/php/20170718/pgsql: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/pgsql.so (/usr/lib/php/20170718/pgsql.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Configuration File (php.ini) Path: /etc/php/7.2/cli
Loaded Configuration File: /etc/php/7.2/cli/php.ini
Scan for additional .ini files in: /etc/php/7.2/cli/conf.d
Additional .ini files parsed: /etc/php/7.2/cli/conf.d/10-mysqlnd.ini,
/etc/php/7.2/cli/conf.d/10-opcache.ini,
/etc/php/7.2/cli/conf.d/10-pdo.ini,
/etc/php/7.2/cli/conf.d/20-calendar.ini,
/etc/php/7.2/cli/conf.d/20-ctype.ini,
/etc/php/7.2/cli/conf.d/20-exif.ini,
/etc/php/7.2/cli/conf.d/20-fileinfo.ini,
/etc/php/7.2/cli/conf.d/20-ftp.ini,
/etc/php/7.2/cli/conf.d/20-gettext.ini,
/etc/php/7.2/cli/conf.d/20-iconv.ini,
/etc/php/7.2/cli/conf.d/20-json.ini,
/etc/php/7.2/cli/conf.d/20-mysqli.ini,
/etc/php/7.2/cli/conf.d/20-pdo_mysql.ini,
/etc/php/7.2/cli/conf.d/20-phar.ini,
/etc/php/7.2/cli/conf.d/20-posix.ini,
/etc/php/7.2/cli/conf.d/20-readline.ini,
/etc/php/7.2/cli/conf.d/20-shmop.ini,
/etc/php/7.2/cli/conf.d/20-sockets.ini,
/etc/php/7.2/cli/conf.d/20-sysvmsg.ini,
/etc/php/7.2/cli/conf.d/20-sysvsem.ini,
/etc/php/7.2/cli/conf.d/20-sysvshm.ini,
/etc/php/7.2/cli/conf.d/20-tokenizer.ini
and I still can't access to phpMyAdmin. When I run php --version I get this
$ php --version
PHP Warning: PHP Startup: Unable to load dynamic library 'mysqli' (tried: /usr/lib/php/20170718/mysqli (/usr/lib/php/20170718/mysqli: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/mysqli.so (/usr/lib/php/20170718/mysqli.so: undefined symbol: mysqlnd_global_stats)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_mysql' (tried: /usr/lib/php/20170718/pdo_mysql (/usr/lib/php/20170718/pdo_mysql: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/pdo_mysql.so (/usr/lib/php/20170718/pdo_mysql.so: undefined symbol: mysqlnd_allocator)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_sqlite' (tried: /usr/lib/php/20170718/pdo_sqlite (/usr/lib/php/20170718/pdo_sqlite: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/pdo_sqlite.so (/usr/lib/php/20170718/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 'pgsql' (tried: /usr/lib/php/20170718/pgsql (/usr/lib/php/20170718/pgsql: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/pgsql.so (/usr/lib/php/20170718/pgsql.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 7.2.34-8+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Oct 31 2020 16:57:15) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.34-8+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
I need to fix this asap to continue working on my laravel application and, when it's done, I need a correct way to install the proper sqlsrv drivers to be able to connect my laravel application to the sql server database.
When I run php -m I get this
$ php -m
PHP Warning: PHP Startup: Unable to load dynamic library 'mysqli' (tried: /usr/lib/php/20170718/mysqli (/usr/lib/php/20170718/mysqli: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/mysqli.so (/usr/lib/php/20170718/mysqli.so: undefined symbol: mysqlnd_global_stats)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_mysql' (tried: /usr/lib/php/20170718/pdo_mysql (/usr/lib/php/20170718/pdo_mysql: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/pdo_mysql.so (/usr/lib/php/20170718/pdo_mysql.so: undefined symbol: mysqlnd_allocator)) in Unknown on line 0
PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_sqlite' (tried: /usr/lib/php/20170718/pdo_sqlite (/usr/lib/php/20170718/pdo_sqlite: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/pdo_sqlite.so (/usr/lib/php/20170718/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 'pgsql' (tried: /usr/lib/php/20170718/pgsql (/usr/lib/php/20170718/pgsql: cannot open shared object file: No such file or directory), /usr/lib/php/20170718/pgsql.so (/usr/lib/php/20170718/pgsql.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
[PHP Modules]
calendar
Core
ctype
date
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
Zend OPcache
zlib
[Zend Modules]
Zend OPcache
and this is what I have now installed with php, nginx, and sql
$ dpkg --get-selections | grep php
libapache2-mod-php7.2 install
php-common install
php-mysql install
php7.2 install
php7.2-cli install
php7.2-common install
php7.2-fpm install
php7.2-json install
php7.2-mysql install
php7.2-opcache install
php7.2-readline install
php7.4-common install
php7.4-mysql
$ dpkg --get-selections | grep nginx
libnginx-mod-http-geoip install
libnginx-mod-http-image-filter install
libnginx-mod-http-xslt-filter install
libnginx-mod-mail install
libnginx-mod-stream install
nginx install
nginx-common install
nginx-core install
$ dpkg --get-selections | grep sql
akonadi-backend-mysql install
libaprutil1-dbd-sqlite3:amd64 install
libmono-sqlite4.0-cil install
libmysqlclient20:amd64 install
libmysqlcppconn7v5:amd64 install
libqt4-sql:amd64 install
libqt4-sql-mysql:amd64 install
libqt5sql5:amd64 install
libqt5sql5-mysql:amd64 install
libqt5sql5-sqlite:amd64 install
libsqlite3-0:amd64 install
libvsqlitepp3v5:amd64 install
msodbcsql17 install
mssql-server install
mssql-tools install
mysql-client install
mysql-client-5.7 install
mysql-client-core-5.7 install
mysql-common install
mysql-server install
mysql-server-5.7 install
mysql-server-core-5.7 install
mysql-utilities install
mysql-workbench install
mysql-workbench-data install
php-mysql install
php7.2-mysql install
php7.4-mysql install
postgresql install
postgresql-10 install
postgresql-client-10 install
postgresql-client-common install
postgresql-common install
postgresql-contrib install
python-mysql.connector install
python-pysqlite2 install
Does anyone know what could I do?
If you need more info tell me in the comments and I'll update the question.
Thanks!
Update 1: Nothing is working yet
I tried to follow this thread to uninstall all php and php7 file and tried to reinstall php7.2, but I can't add the repository when I execute add-apt-repository ppa:ondrej/php becaus the terminal throws me this
Obj:1 https://download.docker.com/linux/ubuntu bionic InRelease
Ign:2 http://ppa.launchpad.net/langdalepl/gvfs-mtp/ubuntu bionic InRelease
Obj:3 https://linux.teamviewer.com/deb stable InRelease
Obj:4 http://ppa.launchpad.net/ondrej/php/ubuntu bionic InRelease
Obj:5 http://dl.google.com/linux/chrome/deb stable InRelease
Obj:6 http://ppa.launchpad.net/wireshark-dev/stable/ubuntu bionic InRelease
Obj:7 http://es.archive.ubuntu.com/ubuntu bionic InRelease
Des:8 http://security.ubuntu.com/ubuntu bionic-security InRelease [88,7 kB]
Des:9 http://archive.neon.kde.org/user bionic InRelease [131 kB]
Obj:10 https://packages.microsoft.com/ubuntu/18.04/mssql-server-2019 bionic InRelease
Err:11 http://ppa.launchpad.net/langdalepl/gvfs-mtp/ubuntu bionic Release
404 Not Found [IP: 91.189.95.83 80]
Ign:12 https://storage.googleapis.com/download.dartlang.org/linux/debian stable InRelease
Obj:13 https://packages.microsoft.com/ubuntu/18.04/prod bionic InRelease
Des:14 http://es.archive.ubuntu.com/ubuntu bionic-updates InRelease [88,7 kB]
Obj:15 https://packages.microsoft.com/ubuntu/16.04/prod xenial InRelease
Obj:16 https://storage.googleapis.com/download.dartlang.org/linux/debian stable Release
Des:17 http://es.archive.ubuntu.com/ubuntu bionic-backports InRelease [74,6 kB]
E: The repository 'http://ppa.launchpad.net/gnome-shell-extensions/ppa/ubuntu bionic Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
I searched for my error and found this, but it doesn't worked for me.
I tried to install php7.2 following the thread and all went well, but when I've executed sudo service apache2 restart I got this
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
so I executed systemctl status apache2.service and it threw this
apache2.service - The Apache HTTP Server
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: failed (Result: exit-code) since Fri 2020-12-11 10:34:22 CET; 1min 31s ago
Process: 4671 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
dic 11 10:34:22 Dev-PC apachectl[4671]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directiv
dic 11 10:34:22 Dev-PC apachectl[4671]: (98)Address already in use: AH00072: make_sock: could not bind to address [::]:80
dic 11 10:34:22 Dev-PC apachectl[4671]: (98)Address already in use: AH00072: make_sock: could not bind to address 0.0.0.0:80
dic 11 10:34:22 Dev-PC apachectl[4671]: no listening sockets available, shutting down
dic 11 10:34:22 Dev-PC apachectl[4671]: AH00015: Unable to open logs
dic 11 10:34:22 Dev-PC apachectl[4671]: Action 'start' failed.
dic 11 10:34:22 Dev-PC apachectl[4671]: The Apache error log may have more information.
dic 11 10:34:22 Dev-PC systemd[1]: apache2.service: Control process exited, code=exited status=1
dic 11 10:34:22 Dev-PC systemd[1]: apache2.service: Failed with result 'exit-code'.
dic 11 10:34:22 Dev-PC systemd[1]: Failed to start The Apache HTTP Server.
What could I do now? I cannot start apache service and I don't know what is failing here...
Update 2: My app and apache2 are working now
I updated my download manager to look for available repositories and bingo, the ondrej repositories were locked, I just unlocked them and tried again to adding the repositories, it worked now. I've reinstalled apache2 with and php7.2 running sudo apt-get install apache2 and following the thread answer. But I had the same problem, so I realized that the error was showing two problems, the first problem was the missing server name and the second was that the port 80 was in use, thats why the apache2 keeps failing when trying to start. For solve the first problem, I ran sudo gedit /etc/apache2/apache2.conf and added Server Name 127.0.0.1 and after save, the first problem was solved, I solved the second problem running sudo lsof -i -n -P | grep ':80' and I discovering that nginx process was using it, so I used sudo kill [the nginx PID] to kill the nginx processes and retried to start apache2 and now it worked. I was able to access to my database in phpmyadmin but now I had another problem, when I execute php artisan serve in my laravel project, I got a PDOConnection.php error because there was a missing driver, and after execute php -m I realized that was the mysql driver so I ran sudo apt-get install php7.2-common php7.2-mysql php7.2-cli and finally I had my apache2 and my php7.2 fixed! Finally thank you all for helping me!
But now I have the same problem I had when all this started, I need to install in the correct way the sqlsrv .so drivers to be able to connect my laravel app with a SQL Server database. I was trying to download the .so files from the microsoft page but that drove me to this nightmare, so does anybody knows how could I continue to installing the sqlsrv drivers correctly?
Update 3: Finally, solved!
Looking for solutions, I checked again the microsoft webpage to find out which sqlsrv drivers I needed to run sql queries with php7.2, and I tried again to run sudo pecl install sqlsrv and sudo pecl install pdo_sqlsrv, but it didn't worked for me. Then I found another way to install the drivers without pecl, and i ran sudo apt-get install php7.2-dev and downloaded the packages with wget http://pecl.php.net/get/sqlsrv-5.3.0.tgz and wget http://pecl.php.net/get/pdo_sqlsrv-5.3.0.tgz (5.3.0 was my sqlsrv version for php7.2), after this I installed with pear install pdo_sqlsrv-5.3.0.tgz and pear install sqlsrv-5.3.0.tgz. This time it worked for me (first time it throwed to me an error telling me that there was an installed version of pdo_sqlsrv, but I ran sudo pear uninstall pecl/pdo_sqlsrv and ran again the install order, then it worked for me). Then, I tried again to run sudo pecl install sqlsrv and sudo pecl install pdo_sqlsrv and this time it worked! After this I ran sudo phpenmod -v 7.2 sqlsrv pdo_sqlsrv and finally I finished the php7.2 sqlsrv drivers installation in my ubuntu! I tried to run again the connection to my database on sql server and it worked.
Thanks for the help!
I updated my post with my progress solving my own question, with the help of bhucho in the comments of my post, I was able to fix my php7.2.
Looking for solutions for install the correct sqlsrv driver for my php version, I checked again the microsoft webpage to find out which sqlsrv drivers I needed to run sql queries with php7.2, and I tried again to run sudo pecl install sqlsrv and sudo pecl install pdo_sqlsrv, but it didn't worked for me. Then I found another way to install the drivers without pecl, and i ran sudo apt-get install php7.2-dev and downloaded the packages with wget http://pecl.php.net/get/sqlsrv-5.3.0.tgz and wget http://pecl.php.net/get/pdo_sqlsrv-5.3.0.tgz (5.3.0 was my sqlsrv version for php7.2), after this I installed with pear install pdo_sqlsrv-5.3.0.tgz and pear install sqlsrv-5.3.0.tgz. This time it worked for me (first time it throwed to me an error telling me that there was an installed version of pdo_sqlsrv, but I ran sudo pear uninstall pecl/pdo_sqlsrv and ran again the install order, then it worked for me). Then, I tried again to run sudo pecl install sqlsrv and sudo pecl install pdo_sqlsrv and this time it worked! After this I ran sudo phpenmod -v 7.2 sqlsrv pdo_sqlsrv and finally I finished the php7.2 sqlsrv drivers installation in my ubuntu! I tried to run again the connection to my database on sql server and it worked.
Thank you all for the help!
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!
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!