PHP启动无法加载动态库/usr/lib/php/20151012/php_mysqli.dll

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39204990/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 01:49:44  来源:igfitidea点击:

PHP Startup Unable to load dynamic library /usr/lib/php/20151012/php_mysqli.dll

phpmysqliamazon-ec2ubuntu-14.04

提问by Jass

I have ubuntu 14.04 EC2 instance. I have installed php 7 on it. when I execute any php command like php --version or any other. I get following error

我有 ubuntu 14.04 EC2 实例。我已经在其上安装了 php 7。当我执行任何 php 命令时,如 php --version 或任何其他命令。我收到以下错误

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

I have tried following

我试过跟随

  1. enable php_mysqli.dll in php.ini
  2. enable mysqli.so
  3. enable php_mysqli.so
  4. sudo apt-get install php-mysql
  1. 在 php.ini 中启用 php_mysqli.dll
  2. 启用 mysqli.so
  3. 启用 php_mysqli.so
  4. 须藤 apt-get 安装 php-mysql

but nothing worked for me.

但没有什么对我有用。

Any suggestion how I can solve this?

任何建议我如何解决这个问题?

回答by jquiaios

If you are on Linux, you shouldn't have DLL files but SO files. So first, you have to remove / disable the php_mysqli.dll you added in php.ini.

如果你在 Linux 上,你不应该有 DLL 文件,而是 SO 文件。因此,首先,您必须删除/禁用您在 php.ini 中添加的 php_mysqli.dll。

In order to use mysqli, you should then :

为了使用 mysqli,你应该:

  • install the package for Ubuntu : apt-get install php-mysql
  • check if it is already enabled (with phpinfo()for example)
  • if not enabled, enable the module - check in /etc/php/mods-available/folder if there is a mysqli.ini, containing extension=mysqli.so, then check for CLI / FPM / Apache / other if there is the symbolic link pointing to this file (for example for CLI, in /etc/php/cli/conf.d/: 20-mysqli.ini -> ../../mods-available/mysqli.ini)
  • restart php / apache / nginx depending what you are using
  • 为 Ubuntu 安装软件包: apt-get install php-mysql
  • 检查它是否已经启用(phpinfo()例如)
  • 如果未启用,启用模块-在检查/etc/php/mods-available/文件夹,如果有一个mysqli.ini,包含extension=mysqli.so,然后检查CLI / FPM / Apache的/其他如果存在符号链接指向该文件(例如,用于CLI,在/etc/php/cli/conf.d/20-mysqli.ini -> ../../mods-available/mysqli.ini
  • 根据您使用的内容重新启动 php / apache / nginx

回答by Nilkamal Gotarne

In my case it happened because i uncommented the extension=php_mysqli.dllline in php.ini file for running some other package. After googling around i found that you should not uncomment anything directly from php.ini instead you should install the required php extension and it will do the rest.

就我而言,这是因为我取消了extension=php_mysqli.dllphp.ini 文件中运行其他包的行的注释。在谷歌搜索之后,我发现你不应该直接从 php.ini 取消注释任何东西,而是应该安装所需的 php 扩展,它会完成剩下的工作。

回答by Babu Pandey

Run Phpinfo()Search for your php.inipath

运行Phpinfo()搜索您的php.ini路径

search extension=php_mysqli.so

搜索 extension=php_mysqli.so

comment like this

像这样评论

;extension=php_mysqli.so

回答by Sylordis

I just had the same problem and realised they were two folders in my /etc/php/7.0, which were apache2and cli. Turned out the extension line in cli/php.iniwas uncommented with the dll file, not the one in apache2directory. Commenting it just solved the problem.

我刚刚遇到了同样的问题,并意识到它们是我的两个文件夹/etc/php/7.0,分别是apache2cli. cli/php.ini结果是 dll 文件中的扩展行没有注释,而不是apache2目录中的。评论它只是解决了问题。

回答by skiwer

I have recently encountered this problem on ubuntu16.04, I finally resolve it by adding a semi-colon at each line like extension=php_*.dll,I think that is because LAMP on ubuntu is intelligent enough,it automatically opens all of the extensions for us. And on windows,we have to enable the extensions manually by remove the semi-colon at each line like ;extension=php_*.dllin php.ini.

我最近在ubuntu16.04上遇到了这个问题,最后我在每行加一个分号解决了extension=php_*.dll,我认为是因为ubuntu上的LAMP足够智能,它会自动为我们打开所有扩展。而在Windows上,我们必须通过手动删除启用扩展在像每行的分号;extension=php_*.dllphp.ini

回答by Lukas Zmoginas

I managed to solved it like this:

我设法解决了这个问题:

  1. add libs to php.ini (etc/php/7.3/apache2; etc/php/7.3/cli folders) extension=pdo_mysql.so

  2. restart apache (sudo systemctl restart apache2)

  3. comment libs in php.ini (etc/php/7.3/apache2; etc/php/7.3/cli folder) extension=pdo_mysql.so

  4. go etc/php/7.3/mod_available

  5. comment extension (because it is already loaded), for example, etc/php/7.3/mod_available/pdo_mysql.ini ;extension=pdo_mysql.so

  1. 将库添加到 php.ini (etc/php/7.3/apache2; etc/php/7.3/cli 文件夹) extension=pdo_mysql.so

  2. 重启 apache (sudo systemctl restart apache2)

  3. php.ini 中的注释库(etc/php/7.3/apache2; etc/php/7.3/cli 文件夹) extension=pdo_mysql.so

  4. 去 etc/php/7.3/mod_available

  5. 注释扩展(因为已经加载了),例如 etc/php/7.3/mod_available/pdo_mysql.ini ;extension=pdo_mysql.so

回答by shivanikoko

If you see mcrypt.so under /etc/php/7.2 or /etc/php/7.3 just delete it and restart the server it will resolve the issue. As when we updrage the php to latest version that file may get stored to latest versions which is not required.

如果您在 /etc/php/7.2 或 /etc/php/7.3 下看到 mcrypt.so 只需将其删除并重新启动服务器即可解决问题。当我们将 php 升级到最新版本时,该文件可能会存储到不需要的最新版本。

I used following commands:

我使用了以下命令:

cd /etc/php/7.3

sudo rm -rf mcrypt.so

sudo service apache2 restart

cd /etc/php/7.3

须藤 rm -rf mcrypt.so

须藤服务 apache2 重启

回答by Oleksii Danylevskyi

Just comment out all lines with .dll extensions because you are on Ubuntu. Ubuntu support .so files.

只需注释掉所有带有 .dll 扩展名的行,因为您使用的是 Ubuntu。Ubuntu 支持 .so 文件。

回答by Triston

In php.iniunder Dynamic Extensionsthe line extension=php_mysqli.dllwas enabled.

php.ini根据Dynamic Extensions该行extension=php_mysqli.dll已启用。

I disabled it by adding a semi-colon at the head of the line ;extension=php_mysqli.dll.

我通过在行的开头添加一个分号来禁用它;extension=php_mysqli.dll

Saved and exited php.ini. Restarted Apache.

保存并退出php.ini。重新启动Apache

This resolved the error for me.

这为我解决了错误。