小编典典

如何在PHP 7中启用MySQLi扩展?

mysql

我已经在Ubuntu 14.04(Trusty Tahr)上安装了PHP 7和MySQL 5.5.47。

我已经使用以下方法检查了已安装的扩展程序:

sudo apt-cache search php7-*

它输出:

php7.0-common - Common files for packages built from the PHP source
libapache2-mod-php7.0 - server-side, HTML-embedded scripting language (Apache 2 module)
php7.0-cgi - server-side, HTML-embedded scripting language (CGI binary)
php7.0-cli - command-line interpreter for the PHP scripting language
php7.0-phpdbg - server-side, HTML-embedded scripting language (PHPDBG binary)
php7.0-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary)
libphp7.0-embed - HTML-embedded scripting language (Embedded SAPI library)
php7.0-dev - Files for PHP7.0 module development
php7.0-dbg - Debug symbols for PHP7.0
php7.0-curl - CURL module for PHP
php7.0-enchant - Enchant module for PHP
php7.0-gd - GD module for PHP
php7.0-gmp - GMP module for PHP
php7.0-imap - IMAP module for PHP
php7.0-interbase - Interbase module for PHP
php7.0-intl - Internationalisation module for PHP
php7.0-ldap - LDAP module for PHP
php7.0-mcrypt - libmcrypt module for PHP
php7.0-readline - readline module for PHP
php7.0-odbc - ODBC module for PHP
php7.0-pgsql - PostgreSQL module for PHP
php7.0-pspell - pspell module for PHP
php7.0-recode - recode module for PHP
php7.0-snmp - SNMP module for PHP
php7.0-tidy - tidy module for PHP
php7.0-xmlrpc - XMLRPC-EPI module for PHP
php7.0-xsl - XSL module for PHP
php7.0 - server-side, HTML-embedded scripting language (metapackage)
php7.0-json - JSON module for PHP
php-all-dev - package depending on all supported PHP development packages
php7.0-sybase - Sybase module for PHP
php7.0-sqlite3 - SQLite3 module for PHP
php7.0-mysql - MySQL module for PHP
php7.0-opcache - Zend OpCache module for PHP
php7.0-bz2 - bzip2 module for PHP

我也无法使用phpinfo()看到MySQLi扩展。如何在PHP 7中启用/安装MySQLi扩展?

这就是为什么我不能使用phpMyAdmin的原因。它说:“缺少mysqli扩展名。”


阅读 901

收藏
2020-05-17

共1个答案

小编典典

我找到了解决方案。我可以在php.ini中启用MySQLi扩展。我只是在php.ini中取消注释了这一行:

extension=php_mysqli.dll

现在,MySQLi运行良好。这是php.iniApache 2,PHP 7和Ubuntu 14.04环境中的文件路径:

/etc/php/7.0/apache2/php.ini

默认情况下,PHP 7中禁用MySQLi扩展。

2020-05-17