尝试访问 phpmyadmin mb_detect_encoding 时出现 PHP 致命错误
不确定发生了什么,但以下是尝试访问 phpmyadmin 时日志给我的内容,请帮助.试图调试一个不同的问题并遇到了这个问题.真的不可能恢复到它工作的时候.
Not sure what happened, but below is what the log is giving me when trying to access phpmyadmin, please help. Trying to debug a different problem and ran into this. Not really possible to revert back to when it was working.
PHP 致命错误:调用未定义的函数 mb_detect_encoding()/usr/share/php/gettext/gettext.inc 在第 177 行
PHP Fatal error: Call to undefined function mb_detect_encoding() in /usr/share/php/gettext/gettext.inc on line 177
尝试访问该站点时,出现此错误,我认为这两个错误可能相关:
When trying to go the the site, I get this error, I think it's likely the two errors are related:
数据库连接错误 (1):MySQL 适配器 'mysqli' 不可用.
Database connection error (1): The MySQL adapter 'mysqli' is not available.
推荐答案
第一个错误是由 php 引起的,因为扩展 mbstring 未安装或未激活.
First error is caused by php because the extension mbstring is either not installed or not active.
第二个错误是 phpMyAdmin/您的站点的输出,要求您安装/启用 mysqli 扩展.
The second error is output of phpMyAdmin/your site asking you to install / enable the mysqli extension.
要启用 mbstring 和 mysqli,请编辑您的 php.ini 并在 unix 上使用 mbstring.so 和 mysqli.so 或在 Windows 上使用 mbstring.dll 和 mysqli.dll 添加/取消注释这两行
To enable mbstring and mysqli edit your php.ini and add/uncomment the two lines with mbstring.so and mysqli.so on unix or mbstring.dll and mysqli.dll on windows
Unix/etc/(phpX/)php.ini
Unix /etc/(phpX/)php.ini
extension=mysqli.so
extension=mbstring.so
Windows PHP 安装文件夹etcphp.ini
Windows PHP installation folderetcphp.ini
extension=mysqli.dll
extension=mbstring.dll
不要忘记在此之后重新启动您的网络服务器.
Don't forget to restart your webserver after this.
用户在评论中补充说他使用的是 redhat 所以这里是你如何在所有基于 CentOS/Fedora/RedHat/Yum 的 Linux 发行版上安装扩展
User added he was using redhat in the comments so here's how you install extensions on all CentOS/Fedora/RedHat/Yum based linux distros
sudo yum install php-mysqli
sudo yum install php-mbstring
restart your werbserver
sudo /etc/init.d/httpd restart
您可以使用文档根目录中的一个小 php 脚本来验证您的安装.这列出了您为 php 安装的所有设置、版本和活动扩展
you can verify your installation with a little php script in your document root. This lists all settings, versions and active extensions you've installed for php
test.php
<?php
phpinfo();
相关文章