"PHP module gd: Missing" I received such an error. and I'm trying to install php5-gd.
apt-get install php5-gd
I am using Ubuntu 16.10 and PHP version 7. I made all the updates.
When I tried to install php5-gd, I got an error like below.
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package php5-gd is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'php5-gd' has no installation candidate
First check which php version you have by sudo php -v. I have php7 so the result is:
PHP 7.0.18-0ubuntu0.17.04.1 (cli) (built: Apr 26 2017 23:59:48) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.18-0ubuntu0.17.04.1, Copyright (c) 1999-2017, by Zend Technologies
since i have php7, I will do the following to list the php packages
sudo apt-cache search php7-*
this returned
libapache2-mod-php7.0 - server-side, HTML-embedded scripting language (Apache 2 module)
php-all-dev - package depending on all supported PHP development packages
php7.0 - server-side, HTML-embedded scripting language (metapackage)
php7.0-cgi - server-side, HTML-embedded scripting language (CGI binary)
php7.0-cli - command-line interpreter for the PHP scripting language
php7.0-common - documentation, examples and common module for PHP
php7.0-curl - CURL module for PHP
php7.0-dev - Files for PHP7.0 module development
php7.0-gd - GD module for PHP
php7.0-gmp - GMP module for PHP
php7.0-json - JSON module for PHP
php7.0-ldap - LDAP module for PHP
php7.0-mysql - MySQL module for PHP
php7.0-odbc - ODBC module for PHP
php7.0-opcache - Zend OpCache module for PHP
php7.0-pgsql - PostgreSQL module for PHP
php7.0-pspell - pspell module for PHP
php7.0-readline - readline module for PHP
php7.0-recode - recode module for PHP
php7.0-snmp - SNMP module for PHP
php7.0-sqlite3 - SQLite3 module for PHP
php7.0-tidy - tidy module for PHP
php7.0-xml - DOM, SimpleXML, WDDX, XML, and XSL module for PHP
php7.0-xmlrpc - XMLRPC-EPI module for PHP
libphp7.0-embed - HTML-embedded scripting language (Embedded SAPI library)
php-amqp - AMQP extension for PHP
php-apcu - APC User Cache for PHP
php-gearman - PHP wrapper to libgearman
php-geoip - GeoIP module for PHP
php-gmagick - Provides a wrapper to the GraphicsMagick library
php-gnupg - PHP wrapper around the gpgme library
php-http - PECL HTTP module for PHP Extended HTTP Support
php-igbinary - igbinary PHP serializer
php-imagick - Provides a wrapper to the ImageMagick library
php-libsodium - PHP wrapper for the Sodium cryptographic library
php-mailparse - Email message manipulation for PHP
php-memcache - memcache extension module for PHP
php-memcached - memcached extension module for PHP, uses libmemcached
php-mongodb - MongoDB driver for PHP
php-msgpack - PHP extension for interfacing with MessagePack
php-oauth - OAuth 1.0 consumer and provider extension
php-pinba - Pinba module for PHP
...and do on
now to install packages run the following command with your desired package
sudo apt-get install php7.0-mysql php7.0-gd php7.0-curl php7.0-recode
note:php7.0-mysql php7.0-gd php7.0-curl php7.0-recode are the package that are listed above.
UPDATE
dont forget to restart apache sudo service apache2 reload
You can use the meta-paclaget php-gd, which is an alias of php7.0-gd
sudo apt-get install php-gd
Please check php version and install modules
apt-get update
apt-get install php5.6-gd
If you want other modules then use this command to get all available modules
apt-cache search php5.*
you have php7 installed but you are trying to install a package of php5 that is the problem
Same issue here.
Use RUN rm /etc/apt/preferences.d/no-debian-php in dockerfile
Also you can see here the solution https://hub.docker.com/_/php
Related
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."
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.
I got the solution. I am able to enable MySQLi extension in php.ini. I just uncommented this line in php.ini:
extension=php_mysqli.dll
Now MySQLi is working well. Here is the php.ini file path in an Apache 2, PHP 7, and Ubuntu 14.04 environment:
/etc/php/7.0/apache2/php.ini
By default, the MySQLi extension is disabled in PHP 7.
sudo phpenmod mysqli
sudo service apache2 restart
phpenmod moduleName enables a module to PHP 7 (restart Apache after that sudo service apache2 restart)
phpdismod moduleName disables a module to PHP 7 (restart Apache after that sudo service apache2 restart)
php -m lists the loaded modules
For all docker users, just run docker-php-ext-install mysqli from inside your php container.
Update: More information on https://hub.docker.com/_/php in the section "How to install more PHP extensions".
On Ubuntu, when mysqli is missing, execute the following,
sudo apt-get install php7.x-mysqli
sudo service apache2 restart
Replace 7.x with your PHP version.
Note: This could be 7.0 and up, but for example Drupal recommends PHP 7.2 on grounds of security among others.
To check your PHP version, on the command-line type:
php -v
You do exactly the same if you are missing mbstring:
apt-get install php7.x-mbstring
service apache2 restart
I recently had to do this for phpMyAdmin when upgrading PHP from 7.0 to 7.2 on Ubuntu 16.04 (Xenial Xerus).
In Ubuntu, you need to uncomment this line in file php.ini which is located at /etc/php/7.0/apache2/php.ini:
extension=php_mysqli.so
In case of docker after installing the mysqli as per Speedy's answer above docker-php-ext-install mysqli you should restart the the fpm as per this answer https://stackoverflow.com/a/43076457/932473
From inside container
kill -USR2 1
Let's use
mysqli_connect
instead of
mysql_connect
because mysql_connect isn't supported in PHP 7.
Ive tried adding the ppa:ondrej/php repository and installing but im still getting this error.
sudo apt-get install php7.1-imap
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package php7.1-imap
E: Couldn't find any package by regex 'php7.1-imap'
Its missing from this: apt-cache search php7.1
php7.1-cli - command-line interpreter for the PHP scripting language
php7.1-readline - readline module for PHP
php7.1-opcache - Zend OpCache module for PHP
php7.1-mysql - MySQL module for PHP
php7.1-zip - Zip module for PHP
php7.1-mbstring - MBSTRING module for PHP
php7.1-json - JSON module for PHP
php7.1-xml - DOM, SimpleXML, WDDX, XML, and XSL module for PHP
php7.1 - server-side, HTML-embedded scripting language (metapackage)
php7.1-gd - GD module for PHP
php7.1-curl - CURL module for PHP
libapache2-mod-php7.1 - server-side, HTML-embedded scripting language (Apache 2 module)
php7.1-common - documentation, examples and common module for PHP
Ubuntu 14.04 is not longer supported by most PPA because its reached its end of life.
Use a newer ubuntu version, like 20.04 LTS. Also php7.1 has already reached end of life too. We already reached php8 now.
I recommend that you learn docker and refactor your code / install your app for php7.4 or php8 (whichever works with php imap) and ubuntu 20.04. I know, its a lot of work but its either this or get left in the dust :/
It looks like PHP 7.2 now comes out of the box on Ubuntu 18.04 but there are 2 versions: 7.2.3-1ubuntu1(base) and 7.2.15-0ubuntu0.18.04.1(security).
When I try run apt install php7.2-fpm I get:
# apt install php7.2-fpm
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
php7.2-fpm : Depends: php7.2-common (= 7.2.3-1ubuntu1) but 7.2.15-0ubuntu0.18.04.1 is to be installed
E: Unable to correct problems, you have held broken packages.
or alternatively:
# apt install php-fpm
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
php-fpm : Depends: php7.2-fpm but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
So I cannot install either of FPM versions.
Note:
1. I've run apt update to update the cache before.
# apt-cache search php7.2
php7.2 - server-side, HTML-embedded scripting language (metapackage)
php7.2-cgi - server-side, HTML-embedded scripting language (CGI binary)
php7.2-cli - command-line interpreter for the PHP scripting language
php7.2-common - documentation, examples and common module for PHP
php7.2-curl - CURL module for PHP
php7.2-dev - Files for PHP7.2 module development
php7.2-gd - GD module for PHP
php7.2-gmp - GMP module for PHP
php7.2-json - JSON module for PHP
php7.2-ldap - LDAP module for PHP
php7.2-mysql - MySQL module for PHP
php7.2-odbc - ODBC module for PHP
php7.2-opcache - Zend OpCache module for PHP
php7.2-pgsql - PostgreSQL module for PHP
php7.2-pspell - pspell module for PHP
php7.2-readline - readline module for PHP
php7.2-recode - recode module for PHP
php7.2-snmp - SNMP module for PHP
php7.2-sqlite3 - SQLite3 module for PHP
php7.2-tidy - tidy module for PHP
php7.2-xml - DOM, SimpleXML, WDDX, XML, and XSL module for PHP
php7.2-xmlrpc - XMLRPC-EPI module for PHP
libphp7.2-embed - HTML-embedded scripting language (Embedded SAPI library)
php-amqp - AMQP extension for PHP
php-apcu - APC User Cache for PHP
php-ds - PHP extension providing efficient data structures for PHP 7
php-gearman - PHP wrapper to libgearman
php-geoip - GeoIP module for PHP
php-gmagick - Provides a wrapper to the GraphicsMagick library
php-gnupg - PHP wrapper around the gpgme library
php-http - PECL HTTP module for PHP Extended HTTP Support
php-igbinary - igbinary PHP serializer
php-imagick - Provides a wrapper to the ImageMagick library
php-libsodium - PHP wrapper for the Sodium cryptographic library
php-mailparse - Email message manipulation for PHP
php-memcache - memcache extension module for PHP
php-memcached - memcached extension module for PHP, uses libmemcached
php-mongodb - MongoDB driver for PHP
php-msgpack - PHP extension for interfacing with MessagePack
php-oauth - OAuth 1.0 consumer and provider extension
php-pinba - Pinba module for PHP
php-propro - propro module for PHP
php-ps - ps module for PHP
php-radius - radius client library for PHP
php-raphf - raphf module for PHP
php-redis - PHP extension for interfacing with Redis
php-rrd - PHP bindings to rrd tool system
php-sass - PHP bindings to libsass - fast, native Sass parsing in PHP
php-smbclient - PHP wrapper for libsmbclient
php-solr - PHP extension for communicating with Apache Solr server
php-ssh2 - Bindings for the libssh2 library
php-stomp - Streaming Text Oriented Messaging Protocol (STOMP) client module for PHP
php-tideways - Tideways PHP Profiler Extension
php-uploadprogress - file upload progress tracking extension for PHP
php-uuid - PHP UUID extension
php-xdebug - Xdebug Module for PHP
php-yac - YAC (Yet Another Cache) for PHP
php-yaml - YAML-1.1 parser and emitter for PHP
php-zmq - ZeroMQ messaging bindings for PHP
php7.2-bcmath - Bcmath module for PHP
php7.2-bz2 - bzip2 module for PHP
php7.2-dba - DBA module for PHP
php7.2-enchant - Enchant module for PHP
php7.2-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary)
php7.2-imap - IMAP module for PHP
php7.2-interbase - Interbase module for PHP
php7.2-intl - Internationalisation module for PHP
php7.2-mbstring - MBSTRING module for PHP
php7.2-phpdbg - server-side, HTML-embedded scripting language (PHPDBG binary)
php7.2-soap - SOAP module for PHP
php7.2-sybase - Sybase module for PHP
php7.2-xsl - XSL module for PHP (dummy)
php7.2-zip - Zip module for PHP
apt update && apt upgrade && apt-get -f install php7.2-fpm didn't help.
Has someone come across this issue before?
To me it looks like a broken dependency. Please help to understand what's going wrong.
Thanks & Regards,
C
The solution was to add missing repositories:
deb http://archive.ubuntu.com/ubuntu bionic-security multiverse
deb http://archive.ubuntu.com/ubuntu bionic-security universe
deb http://archive.ubuntu.com/ubuntu bionic-updates multiverse
deb http://archive.ubuntu.com/ubuntu bionic-updates universe
I have PHP GD installed and enabled:
sudo gedit /etc/php/7.0/apache2/php.ini
;extension=php_bz2.dll
extension=php_curl.dll
;extension=php_fileinfo.dll
;extension=php_ftp.dll
extension=php_gd2.dll
But I cannot find it on the phpinfo(); screen, nor can I find it using the code below:
if (extension_loaded('gd') && function_exists('gd_info')) {
echo "PHP GD library is installed on your web server";
}
else {
echo "PHP GD library is NOT installed on your web server";
}
Result: PHP GD library is NOT installed on your web server
I am on PHP 7.0:
$ php -v
PHP 7.0.22-0ubuntu0.17.04.1 (cli) (built: Aug 8 2017 22:03:30) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.22-0ubuntu0.17.04.1, Copyright (c) 1999-2017, by Zend Technologies
Any idea why and how I can fix it?
I am on Kubuntu 17.10 btw
If I go ahead installing it again:
$ sudo apt-get install php7.0-gd
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package php7.0-gd is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'php7.0-gd' has no installation candidate
Why??
EDIT 1:
$ sudo apt-get install php-gd
Reading package lists... Done
Building dependency tree
Reading state information... Done
php-gd is already the newest version (1:7.1+54ubuntu1).
0 to upgrade, 0 to newly install, 0 to remove and 86 not to upgrade.
EDIT 2:
But there is something strange - I am on PHP 7.0 but the GD below is php7.1-gd,
$ sudo apt-cache search php7-*
libapache2-mod-php7.1 - server-side, HTML-embedded scripting language (Apache 2 module)
php-all-dev - package depending on all supported PHP development packages
php7.1 - server-side, HTML-embedded scripting language (metapackage)
php7.1-cgi - server-side, HTML-embedded scripting language (CGI binary)
php7.1-cli - command-line interpreter for the PHP scripting language
php7.1-common - documentation, examples and common module for PHP
php7.1-curl - CURL module for PHP
php7.1-dev - Files for PHP7.1 module development
php7.1-gd - GD module for PHP
php7.1-gmp - GMP module for PHP
php7.1-json - JSON module for PHP
php7.1-ldap - LDAP module for PHP
php7.1-mysql - MySQL module for PHP
php7.1-odbc - ODBC module for PHP
php7.1-opcache - Zend OpCache module for PHP
php7.1-pgsql - PostgreSQL module for PHP
php7.1-pspell - pspell module for PHP
php7.1-readline - readline module for PHP
php7.1-recode - recode module for PHP
php7.1-snmp - SNMP module for PHP
php7.1-sqlite3 - SQLite3 module for PHP
php7.1-tidy - tidy module for PHP
php7.1-xml - DOM, SimpleXML, WDDX, XML, and XSL module for PHP
php7.1-xmlrpc - XMLRPC-EPI module for PHP
libphp7.1-embed - HTML-embedded scripting language (Embedded SAPI library)
php-amqp - AMQP extension for PHP
php-apcu - APC User Cache for PHP
php-ds - PHP extension providing efficient data structures for PHP 7
php-gearman - PHP wrapper to libgearman
php-geoip - GeoIP module for PHP
php-gmagick - Provides a wrapper to the GraphicsMagick library
php-gnupg - PHP wrapper around the gpgme library
php-http - PECL HTTP module for PHP Extended HTTP Support
php-igbinary - igbinary PHP serializer
php-imagick - Provides a wrapper to the ImageMagick library
php-libsodium - PHP wrapper for the Sodium cryptographic library
php-mailparse - Email message manipulation for PHP
php-memcache - memcache extension module for PHP
php-memcached - memcached extension module for PHP, uses libmemcached
php-mongodb - MongoDB driver for PHP
php-msgpack - PHP extension for interfacing with MessagePack
php-oauth - OAuth 1.0 consumer and provider extension
php-pinba - Pinba module for PHP
php-propro - propro module for PHP
php-ps - ps module for PHP
php-radius - radius client library for PHP
php-raphf - raphf module for PHP
php-redis - PHP extension for interfacing with Redis
php-remctl - PECL module for Kerberos-authenticated command execution
php-rrd - PHP bindings to rrd tool system
php-sass - PHP bindings to libsass - fast, native Sass parsing in PHP
php-smbclient - PHP wrapper for libsmbclient
php-solr - PHP extension for communicating with Apache Solr server
php-ssh2 - Bindings for the libssh2 library
php-stomp - Streaming Text Oriented Messaging Protocol (STOMP) client module for PHP
php-symfony-polyfill-php70 - Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
php-tideways - Tideways PHP Profiler Extension
php-uploadprogress - file upload progress tracking extension for PHP
php-uuid - PHP UUID extension
php-xdebug - Xdebug Module for PHP
php-yac - YAC (Yet Another Cache) for PHP
php-yaml - YAML-1.1 parser and emitter for PHP
php-zmq - ZeroMQ messaging bindings for PHP
php7.1-bcmath - Bcmath module for PHP
php7.1-bz2 - bzip2 module for PHP
php7.1-dba - DBA module for PHP
php7.1-enchant - Enchant module for PHP
php7.1-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary)
php7.1-imap - IMAP module for PHP
php7.1-interbase - Interbase module for PHP
php7.1-intl - Internationalisation module for PHP
php7.1-mapi - Complete and feature rich groupware solution - PHP MAPI bindings
php7.1-mbstring - MBSTRING module for PHP
php7.1-mcrypt - libmcrypt module for PHP
php7.1-phpdbg - server-side, HTML-embedded scripting language (PHPDBG binary)
php7.1-soap - SOAP module for PHP
php7.1-sybase - Sybase module for PHP
php7.1-xsl - XSL module for PHP (dummy)
php7.1-zip - Zip module for PHP
php7cc - command line tool to detect PHP 7 incompatible code
php7.0-mysql - MySQL module for PHP
php7.0-readline - readline module for PHP
php7.0-opcache - Zend OpCache module for PHP
php7.0-mbstring - MBSTRING module for PHP
php7.0 - server-side, HTML-embedded scripting language (metapackage)
php7.0-cgi - server-side, HTML-embedded scripting language (CGI binary)
libapache2-mod-php7.0 - server-side, HTML-embedded scripting language (Apache 2 module)
php7.0-mcrypt - libmcrypt module for PHP
php7.0-curl - CURL module for PHP
php7.0-cli - command-line interpreter for the PHP scripting language
php7.0-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary)
php7.0-xmlrpc - XMLRPC-EPI module for PHP
php7.0-json - JSON module for PHP
php7.0-common - documentation, examples and common module for PHP
php7.0-xml - DOM, SimpleXML, WDDX, XML, and XSL module for PHP
Is this causing the problem? Should I uninstall php7.1-gd?
I finally got it working following these 3 steps:
uninstalled PHP and all its libs from my machine following this answer.
upgraded Ubuntu to 18.04 following this guide.
installed PHP 7.2 following this guide.*
On my terminal:
$ sudo apt-get install php
$ sudo apt-get install php-pear php-fpm php-dev php-zip php-curl php-xmlrpc php-gd php-mysql php-mbstring php-xml libapache2-mod-php
$ php -v
PHP 7.2.5-0ubuntu0.18.04.1 (cli) (built: May 9 2018 17:21:02) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.5-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies
$ sudo systemctl restart apache2
Result:
It took a few hours but worth it!
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."
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.
I got the solution. I am able to enable MySQLi extension in php.ini. I just uncommented this line in php.ini:
extension=php_mysqli.dll
Now MySQLi is working well. Here is the php.ini file path in an Apache 2, PHP 7, and Ubuntu 14.04 environment:
/etc/php/7.0/apache2/php.ini
By default, the MySQLi extension is disabled in PHP 7.
sudo phpenmod mysqli
sudo service apache2 restart
phpenmod moduleName enables a module to PHP 7 (restart Apache after that sudo service apache2 restart)
phpdismod moduleName disables a module to PHP 7 (restart Apache after that sudo service apache2 restart)
php -m lists the loaded modules
For all docker users, just run docker-php-ext-install mysqli from inside your php container.
Update: More information on https://hub.docker.com/_/php in the section "How to install more PHP extensions".
On Ubuntu, when mysqli is missing, execute the following,
sudo apt-get install php7.x-mysqli
sudo service apache2 restart
Replace 7.x with your PHP version.
Note: This could be 7.0 and up, but for example Drupal recommends PHP 7.2 on grounds of security among others.
To check your PHP version, on the command-line type:
php -v
You do exactly the same if you are missing mbstring:
apt-get install php7.x-mbstring
service apache2 restart
I recently had to do this for phpMyAdmin when upgrading PHP from 7.0 to 7.2 on Ubuntu 16.04 (Xenial Xerus).
In Ubuntu, you need to uncomment this line in file php.ini which is located at /etc/php/7.0/apache2/php.ini:
extension=php_mysqli.so
In case of docker after installing the mysqli as per Speedy's answer above docker-php-ext-install mysqli you should restart the the fpm as per this answer https://stackoverflow.com/a/43076457/932473
From inside container
kill -USR2 1
Let's use
mysqli_connect
instead of
mysql_connect
because mysql_connect isn't supported in PHP 7.