Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I enable the MySQLi extension in PHP 7?

I have installed PHP 7 and MySQL 5.5.47 on Ubuntu 14.04 (Trusty Tahr).

I have checked installed extension using:

sudo apt-cache search php7-* 

It outputs:

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 

I am not able to see the MySQLi extension using phpinfo() either. How can I enable/install MySQLi extension in PHP 7?

That's why I cannot use phpMyAdmin. It says "The mysqli extension is missing."

like image 325
Mohammad Sayeed Avatar asked Feb 16 '16 06:02

Mohammad Sayeed


People also ask

Does MySQLi run PHP 7?

PHP 7 only allows connections to a MySQL database using mysqli or PDO_MySQL.

Does PHP 7.4 support MySQLi?

PHP 7.4 now supports MySQL with caching_sha2_password, although it is a bit unclear around older versions, there seems to be conflicting reports.

How configure MySQLi in PHP?

Open your php. ini file ( php configuration file ) inside your PHP directory ( or windows directory ) . Search for mysqli and enable the dll by removing ; before it. You may have to re-boot your system.

How do I know if MySQLi extension is installed?

Check if MySQLi is Installed The first step is to check if MySQLi extension is installed. You can do that by visiting a phpinfo() page that you made, or by running this command: php -m | grep mysqli.

How do I download MySQLi extension?

Simply download the installer package, unzip it anywhere, and run setup.exe. Default installer setup.exe will walk you through the trivial process and by default will install everything under C:\mysql.


1 Answers

The problem is that the package that used to connect PHP to MySQL is deprecated (php5-mysql). If you install the new package,

sudo apt-get install php-mysql 

this will automatically update Apache and PHP 7.

like image 55
Xeno Avatar answered Sep 21 '22 21:09

Xeno