Php warning php startup unable to load dynamic library mysql so

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHP Warning: PHP Startup: Unable to load dynamic library ‘mysqli’ #8516

PHP Warning: PHP Startup: Unable to load dynamic library ‘mysqli’ #8516

Comments

Description

I have enabled mysqli extension for php 8.1 on ubuntu 20.04.

After enabling extension I’m getting the following error:

PHP Warning: PHP Startup: Unable to load dynamic library 'mysqli' (tried: /usr/lib/php/20210902/mysqli (/usr/lib/php/20210902/mysqli: cannot open shared object file: No such file or directory), /usr/lib/php/20210902/mysqli.so (/usr/lib/php/20210902/mysqli.so: undefined symbol: mysqlnd_global_stats)) in Unknown on line 0

I have installed the current packages.

When I do php —ini . I get the following output.

PHP Warning: PHP Startup: Unable to load dynamic library 'mysqli' (tried: /usr/lib/php/20210902/mysqli (/usr/lib/php/20210902/mysqli: cannot open shared object file: No such file or directory), /usr/lib/php/20210902/mysqli.so (/usr/lib/php/20210902/mysqli.so: undefined symbol: mysqlnd_global_stats)) in Unknown on line 0 Configuration File (php.ini) Path: /etc/php/8.1/cli Loaded Configuration File: /etc/php/8.1/cli/php.ini Scan for additional .ini files in: /etc/php/8.1/cli/conf.d Additional .ini files parsed: /etc/php/8.1/cli/conf.d/10-mysqlnd.ini, /etc/php/8.1/cli/conf.d/10-opcache.ini, /etc/php/8.1/cli/conf.d/10-pdo.ini, /etc/php/8.1/cli/conf.d/20-calendar.ini, /etc/php/8.1/cli/conf.d/20-ctype.ini, /etc/php/8.1/cli/conf.d/20-exif.ini, /etc/php/8.1/cli/conf.d/20-ffi.ini, /etc/php/8.1/cli/conf.d/20-fileinfo.ini, /etc/php/8.1/cli/conf.d/20-ftp.ini, /etc/php/8.1/cli/conf.d/20-gettext.ini, /etc/php/8.1/cli/conf.d/20-iconv.ini, /etc/php/8.1/cli/conf.d/20-mysqli.ini, /etc/php/8.1/cli/conf.d/20-pdo_mysql.ini, /etc/php/8.1/cli/conf.d/20-phar.ini, /etc/php/8.1/cli/conf.d/20-posix.ini, /etc/php/8.1/cli/conf.d/20-readline.ini, /etc/php/8.1/cli/conf.d/20-shmop.ini, /etc/php/8.1/cli/conf.d/20-sockets.ini, /etc/php/8.1/cli/conf.d/20-sysvmsg.ini, /etc/php/8.1/cli/conf.d/20-sysvsem.ini, /etc/php/8.1/cli/conf.d/20-sysvshm.ini, /etc/php/8.1/cli/conf.d/20-tokenizer.ini

I’m note sure mysqlnd extension. I have not added it or enabled it in any of the php.ini file.

NOTE: I’m facing exact similar issue in the macos as well. Not sure which package or configuration I’m missing and because of that I’m getting this error.

Источник

PHP startup unable to load dynamic library warning

Most often, this happens when PHP can’t find the extension you defined in your php.ini file.

For example, the error goes like this:

To solve this warning, you need to make sure that PHP is able to find the required extension.

First, find the php.ini file location by running the phpinfo() function as follows:

Find php.ini location

Once you find the php.ini location, open the file and search for the line that says extension_dir as shown below:

 The extension_dir configuration is used to define a folder where your PHP extensions are stored.

Open the extension_dir using your file explorer and see if the extension that causes the warning exists in that folder.

For example, the mysqli extension requires the php_mysqli.dll file (Windows) or php_mysqli.so (UNIX-like)

When you don’t find the file, then you need to somehow get it from the Internet.

For Windows, you can download the compiled PHP version from windows.php.net and get the extension in ext/ folder in the zip file.

You need to copy the extension from the ext/ folder to your extension_dir folder.

For UNIX-like OS, you can install PHP extensions with PEAR.

Once you have the extension, restart your PHP server. The warning should now disappear.

If you know that you don’t need the extension, you can comment out the extension to make the warning go away.

Add a semicolon ( ; ) before the extension configuration as shown below:

Save the changes to the php.ini file and restart your PHP server. You should no longer see the warning.

Now you’ve learned how to solve the warning PHP Startup: Unable to load dynamic library. Great work! 👍

Take your skills to the next level ⚡️

I’m sending out an occasional email with the latest tutorials on programming, web development, and statistics. Drop your email in the box below and I’ll send new stuff straight into your inbox!

About

Hello! This website is dedicated to help you learn tech and data science skills with its step-by-step, beginner-friendly tutorials.
Learn statistics, JavaScript and other programming languages using clear examples written for people.

Type the keyword below and hit enter

Tags

Click to see all tutorials tagged with:

Источник

Php warning php startup unable to load dynamic library mysql so

Доброго времени . выскакивают вот такие ошибки,
но локальная машина работает.

$php -v
PHP Warning: PHP Startup: Unable to load dynamic library ‘pdo_mysql.so’ (tried: /usr/lib/php/20180731/pdo_mysql.so (/usr/lib/php/20180731/pdo_mysql.so: undefined symbol: pdo_parse_params), /usr/lib/php/20180731/pdo_mysql.so.so (/usr/lib/php/20180731/pdo_mysql.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 7.3.3-1+0~20190307202245.32+stretch~1.gbp 32ebb2 (cli) (built: Mar 7 2019 20:22:46) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.3, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.3-1+0~20190307202245.32+stretch~1.gbp 32ebb2, Copyright (c) 1999-2018, by Zend Technologies

$ php composer.phar update
PHP Warning: PHP Startup: Unable to load dynamic library ‘pdo_mysql.so’ (tried: /usr/lib/php/20180731/pdo_mysql.so (/usr/lib/php/20180731/pdo_mysql.so: undefined symbol: pdo_parse_params), /usr/lib/php/20180731/pdo_mysql.so.so (/usr/lib/php/20180731/pdo_mysql.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Fatal error: Uncaught Error: Class ‘Phar’ not found in /var/www/example.com/basic/composer.phar:23
Stack trace:
#0
thrown in /var/www/example.com/basic/composer.phar on line 23

Что они обозначают?
Как можно их исправить?

$ sudo apt-get install php7.0-mysql
[sudo] пароль для jessie:
Чтение списков пакетов… Готово
Построение дерева зависимостей
Чтение информации о состоянии… Готово
Будут установлены следующие дополнительные пакеты:
php7.0-common
НОВЫЕ пакеты, которые будут установлены:
php7.0-common php7.0-mysql
обновлено 0, установлено 2 новых пакетов, для удаления отмечено 0 пакетов, и 3 пакетов не обновлено.
Необходимо скачать 661 kБ архивов.
После данной операции, объём занятого дискового пространства возрастёт на 4*870 kB.
Хотите продолжить? [Д/н] y
Пол:1 https://packages.sury.org/php stretch/main amd64 php7.0-common amd64 7.0.33-5+0~20190309015553.9+stretch~1.gbp4 c6517 [537 kB]
Пол:2 https://packages.sury.org/php stretch/main amd64 php7.0-mysql amd64 7.0.33-5+0~20190309015553.9+stretch~1.gbp4 c6517 [124 kB]
Получено 661 kБ за 3с (169 kБ/c)
Выбор ранее не выбранного пакета php7.0-common.
(Чтение базы данных … на данный момент установлено 146535 файлов и каталогов.)
Подготовка к распаковке …/php7.0-common_7.0.33-5+0~20190309015553.9+stretch~1.gbp4 c6517_amd64.deb …
Распаковывается php7.0-common (7.0.33-5+0~20190309015553.9+stretch~1.gbp4 c6517) …
Выбор ранее не выбранного пакета php7.0-mysql.
Подготовка к распаковке …/php7.0-mysql_7.0.33-5+0~20190309015553.9+stretch~1.gbp4 c6517_amd64.deb …
Распаковывается php7.0-mysql (7.0.33-5+0~20190309015553.9+stretch~1.gbp4 c6517) …
Настраивается пакет php7.0-common (7.0.33-5+0~20190309015553.9+stretch~1.gbp4 c6517) …
Not replacing deleted config file /etc/php/7.0/mods-available/calendar.ini
Not replacing deleted config file /etc/php/7.0/mods-available/ctype.ini
Not replacing deleted config file /etc/php/7.0/mods-available/exif.ini
Not replacing deleted config file /etc/php/7.0/mods-available/fileinfo.ini
Not replacing deleted config file /etc/php/7.0/mods-available/ftp.ini
Not replacing deleted config file /etc/php/7.0/mods-available/gettext.ini
Not replacing deleted config file /etc/php/7.0/mods-available/iconv.ini
Not replacing deleted config file /etc/php/7.0/mods-available/pdo.ini
Not replacing deleted config file /etc/php/7.0/mods-available/phar.ini
Not replacing deleted config file /etc/php/7.0/mods-available/posix.ini
Not replacing deleted config file /etc/php/7.0/mods-available/shmop.ini
Not replacing deleted config file /etc/php/7.0/mods-available/sockets.ini
Not replacing deleted config file /etc/php/7.0/mods-available/sysvmsg.ini
Not replacing deleted config file /etc/php/7.0/mods-available/sysvsem.ini
Not replacing deleted config file /etc/php/7.0/mods-available/sysvshm.ini
Not replacing deleted config file /etc/php/7.0/mods-available/tokenizer.ini
Настраивается пакет php7.0-mysql (7.0.33-5+0~20190309015553.9+stretch~1.gbp4 c6517) …
Not replacing deleted config file /etc/php/7.0/mods-available/mysqlnd.ini
Not replacing deleted config file /etc/php/7.0/mods-available/mysqli.ini
Not replacing deleted config file /etc/php/7.0/mods-available/pdo_mysql.ini

Всё по прежнему каки было..

Тут же ошибка, что /usr/lib/php/20180731/pdo_mysql.so.so — не найден, а должный файл pdo_mysql.so найти не может

Может что в php.ini наделали не то? Посмотрите строчку в extensions, может когда копипастили — косяк был

Мне кажется в своём проекте Вы используете mysqli, а не PDO, поэтому всё и работает

Источник

Читайте также:  Stack trace of exceptions java
Оцените статью