当我进入 phpmyadmin 时它显示:
The mysqli extension is missing. Please check your PHP configuration. <a href="Documentation.html#faqmysql" target="documentation"><img src="themes/dot.gif" title="Documentation" alt="Documentation" class="icon ic_b_help" /></a>
我也安装了 wordpress,上面显示:
Your PHP installation appears to be missing the MySQL extension which is required by WordPress.
因此 php mysql 扩展不起作用,但它已安装。
root@john:~# sudo apt-get install php5-mysql
Reading package lists... Done
Building dependency tree
Reading state information... Done
php5-mysql is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
我尝试删除它并重新安装但遇到了问题:
root@john:~# sudo apt-get purge php5-mysql
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
dbconfig-common libdbd-mysql-perl libmcrypt4 mysql-client mysql-client-5.5 mysql-
client-core-5.5 php5-mcrypt
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
php5-mysql*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 245 kB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 326631 files and directories currently installed.)
Removing php5-mysql ...
dpkg: error processing php5-mysql (--purge):
subprocess installed pre-removal script returned error exit status 1
Processing triggers for libapache2-mod-php5 ...
Action 'configtest' failed.
The Apache error log may have more information.
Your apache2 configuration is broken, so we're not restarting it for you.
Errors were encountered while processing:
php5-mysql
E: Sub-process /usr/bin/dpkg returned an error code (1)
注意:一切都运行正常,直到我删除了一些文件夹(可能是 apache2),然后当我再次尝试安装 LAMP 时遇到了麻烦。
答案1
mysqli 包含在 php5-mysql 包中。运行包含的 php 脚本phpinfo()
并检查是否启用了 MySQLi 支持。
如果不是,您必须编辑您的 PHP 配置。如果不存在将以下行添加到您的 php.ini 文件:
extension=mysqli.so
(之后重新启动 Apache)