2016-02-16 4 views
35

Ich habe PHP 7, MySQL 5.5.47 auf Ubuntu 14.04 installiert. Ich habe installierte Erweiterung geprüft werden:Wie aktiviert man MySQLi Erweiterung in PHP 7?

sudo apt-cache search php7-* 

Seinen Ausgang ich:

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 

Ich bin nicht in der Lage MySQLi Erweiterung mit phpinfo() als auch, lass es mich wissen, wie man sehen kann ich aktivieren/installiere MySQLi-Erweiterung in PHP 7. Deshalb kann ich phpmyadmin nicht verwenden, es sagt "Die mysqli-Erweiterung fehlt."

Hinweis: Ich bin neu in PHP7.

Antwort

23

Ich habe die Lösung, ich bin in der Lage MySQLi Erweiterung in der php.ini zu aktivieren, unkommentiert nur diese Zeile in der php.ini

extension=php_mysqli.dll 

Jetzt MySQLi well.Here Arbeits ist php.ini Pfad in apache2, PHP 7, Ubuntu 14.04 Umgebung:

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

Durch Vorgabe MySQLi Erweiterung ist disable in PHP 7.

+14

'php_mysqli.dll' ist für Windows. – miken32

+0

Das funktionierte für mich auf MacPorts (macOS Sierra). –

+1

Danke Es hat eine Weile gedauert, bis meine Wordpress-Installation lief, da mysql_ * in php7 veraltet ist, das half! – Vibhu

9

ubuntu in benötigen diese Zeile in php.ini unkommentiert die bei /etc/php/7.0/apache2/php.ini

extension = php_mysqli.so

+4

Diese Zeile ist nicht in der php.ini mit Ubuntu 16.04. Fügen Sie es hinzu? – motorbaby

+0

bei PHP 7.0 funktioniert phpenmode youModule.ini – Kasikn77

59

Das Problem liegt, ist, dass das Paket, das PHP MYSQL zu verbinden ist depricated (php5-mysql). Wenn Sie das neue Paket installieren:

sudo apt-get install php-mysql 

Dies wird automatisch aktualisiert Apache und PHP7.

Prost!

+7

Dies ist die richtige Antwort für Ubuntu (16.04). Starten Sie anschließend den Apache neu: 'sudo service apache2 restart' – scoobydoo

+1

Denken Sie daran,' sudo apt-get update' zuvor zu verwenden. –

+0

Danke Xeno. Dies ist eine gültige Antwort für Ubuntu (16.04), PHP 7.1 @scoobydoo ist richtig. Starten Sie danach den Apache neu. – Riz

3
sudo phpenmod mysqli 
sudo service apache2 restart