简体   繁体   English

PHP 警告:PHP 启动:无法加载动态库“pdo_mysql.so”

[英]PHP Warning: PHP Startup: Unable to load dynamic library 'pdo_mysql.so'

I ran the command:我运行了命令:

php -v

Output: Output:

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

I ran this command:我运行了这个命令:

php -m

Output: Output:

PHP Warning:  PHP Startup: Unable to load dynamic library 'pdo_mysql.so' (tried: /usr/lib/php/20170718/pdo_mysql.so (/usr/lib/php/20170718/pdo_mysql.so: undefined symbol: mysqlnd_allocator), /usr/lib/php/20170718/pdo_mysql.so.so (/usr/lib/php/20170718/pdo_mysql.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
    [PHP Modules]
    bz2
    calendar
    Core
    ctype
    curl
    date
    dom
    exif
    fileinfo
    filter
    ftp
    gd
    gettext
    hash
    iconv
    intl
    json
    libxml
    mbstring
    openssl
    pcntl
    pcre
    PDO
    Phar
    posix
    readline
    Reflection
    session
    shmop
    SimpleXML
    soap
    sockets
    sodium
    SPL
    standard
    sysvmsg
    sysvsem
    sysvshm
    tokenizer
    wddx
    xml
    xmlreader
    xmlwriter
    xsl
    Zend OPcache
    zip
    zlib

    [Zend Modules]
    Zend OPcache

The php.ini file contains this line: php.ini 文件包含以下行:

extension=pdo_mysql

Ran this command:运行此命令:

sudo apt-get install -y php-pdo-mysql

Nothing is installed, because it is already installed.什么都没有安装,因为它已经安装了。

Ran this command:运行此命令:

php -i

Output shows: Output 显示:

PDO

PDO support => enabled
PDO drivers =>

Not sure why this is or what to do.不知道为什么会这样或该怎么办。 Any suggestions?有什么建议么?

I solved the problem this way:我这样解决了这个问题:

sudo apt-get --purge remove php-common

sudo apt-get install php-common php-mysql php-cli

Now there is no error and php -m shows it has everything:现在没有错误,并且php -m显示它拥有一切:

You are probably using php7.2, so you should edit the php.ini file ( /etc/php/7.2/cli/php.ini ).您可能正在使用 php7.2,因此您应该编辑php.ini文件 ( /etc/php/7.2/cli/php.ini )。

And probably extension=pdo_mysql on line 906 is uncommented.并且可能未注释第906行上的extension=pdo_mysql Comment this line by adding ;通过添加注释此行 at the beginning of the line.在行的开头。

After saving and closing php.ini the error should disappear, however, to ensure that the changes take effect, restart the php service:保存并关闭 php.ini 后,错误应该会消失,但是,为确保更改生效,请重新启动 php 服务:

$ sudo systemctl restart php7.2-fpm

Make sure that the location of pdo_mysql.so file is the same of the PHP extension_dir:确保 pdo_mysql.so 文件的位置与 PHP extension_dir 的位置相同:

# php -i|grep extension_dir
# find / -name pdo_mysql.so

By doing this, and adding the absolute path on the php.ini like this:通过这样做,并在 php.ini 上添加绝对路径,如下所示:

extension=/usr/lib/php/20190902/pdo_mysql

this will work.这会奏效。

I have 7.4 php version.我有 7.4 php 版本。 I solved this by uncommenting the following line by removing;我通过删除取消注释以下行来解决这个问题; inside the php.ini file.在 php.ini 文件中。

extension_dir = "ext"

Note that initially, you won't have php.ini file so first you should copy and paste php.ini-development file and rename it as php.ini.请注意,最初,您不会有 php.ini 文件,因此首先您应该复制并粘贴 php.ini-development 文件并将其重命名为 php.ini。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 PHP启动:无法加载动态库“ pdo_mysql.so” - PHP Startup: Unable to load dynamic library 'pdo_mysql.so' PHP警告:PHP启动:无法加载动态库'/usr/lib/php/extensions/no-debug-zts-20131226/pdo_mysql.so' - PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/extensions/no-debug-zts-20131226/pdo_mysql.so' EasyApache 4:“ PHP启动:无法加载动态库'pdo_mysql.so'” - EasyApache 4: “PHP Startup: Unable to load dynamic library 'pdo_mysql.so'” 无法加载动态库“pdo_mysql.so”,因为将 php 版本升级到 7.4 - Unable to load dynamic library 'pdo_mysql.so' because upgrade php version to 7.4 PHP 启动:无法加载动态库“pdo-sqlite.so” - PHP Startup: Unable to load dynamic library 'pdo-sqlite.so' PHP警告:PHP启动:无法加载动态库'/usr/lib/php/20151012/mysql.so' - PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/mysql.so' PHP警告:PHP启动:无法加载动态库phalcon.so:未定义符号:php_pdo_g $ - PHP Warning: PHP Startup: Unable to load dynamic library phalcon.so: undefined symbol: php_pdo_g$ 警告:PHP启动:无法加载动态库apc.so - Warning: PHP Startup: Unable to load dynamic library apc.so PHP 警告 PHP 启动无法加载动态库 php_pdo_sqlsrv_7_ts_x64.dll - PHP Warning PHP Startup Unable to load dynamic library php_pdo_sqlsrv_7_ts_x64.dll 警告:PHP 启动:无法加载动态库 - Warning: PHP Startup: Unable to load dynamic library
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM