0

I have installed PHP-MySQL module using

sudo apt-get install php-mysql 

but it is showing it has not installed what to do? In ubuntu 16.04.
This is the status, it is showing

root@simple1-ThinkCentre-M710t:/home/simple1# whereis php-mysql
php-mysql:
MarianD
  • 1,028
gupta
  • 1

2 Answers2

1

php-mysql is a meta package that causes the installation of the real package with the binary. In Ubuntu 18.04, this is in php7.2-mysql. You can check the installed packages.

dpkg -l |grep mysql |grep php
ii  php-mysql                                  1:7.2+60ubuntu1                             all          MySQL module for PHP [default]
ii  php7.2-mysql                               7.2.5-0ubuntu0.18.04.1                      amd64        MySQL module for PHP

And using whereis

whereis php7.2-mysql
php7: /usr/bin/php7.2 /usr/share/php7.2-sqlite3 /usr/share/php7.2-ldap /usr/share/php7.2-common /usr/share/php7.2-mbstring /usr/share/php7.2-readline /usr/share/php7.2-pgsql /usr/share/php7.2-opcache /usr/share/php7.2-mysql /usr/share/php7.2-xml /usr/share/php7.2-json

You can learn more about meta-packages from the MetaPackages Wiki Docs

Elder Geek
  • 36,023
  • 25
  • 98
  • 183
Bernard Wei
  • 2,125
0

In Ubuntu 16.04

You aren't using an appropriate method to check if a package is installed.

In your case one of the easy ways would be apt -qq list php-mysql which if installed will output

php-mysql/xenial-updates,xenial-updates,now 1:7.0+35ubuntu6.1 all [installed] and if not you'll get the same output without the [installed]

php-mysql isn't much of a package as it contains only:

/usr/share/doc/php-mysql/changelog.gz
/usr/share/doc/php-mysql/copyright

It however depends on php-common which contains:

/etc/cron.d/php
/usr/lib/php/php-helper
/usr/lib/php/php-maintscript-helper
/usr/lib/php/sessionclean
/usr/sbin/phpdismod
/usr/sbin/phpenmod
/usr/sbin/phpquery
/usr/share/doc/php-common/changelog.gz
/usr/share/doc/php-common/copyright

and php7.0-mysql which contains

/usr/lib/php/20151012/mysqli.so
/usr/lib/php/20151012/mysqlnd.so
/usr/lib/php/20151012/pdo_mysql.so
/usr/share/bug/php7.0-mysql/control
/usr/share/bug/php7.0-mysql/script
/usr/share/doc/php7.0-mysql
/usr/share/lintian/overrides/php7.0-mysql
/usr/share/php7.0-mysql/mysql/mysqli.ini
/usr/share/php7.0-mysql/mysql/mysqlnd.ini
/usr/share/php7.0-mysql/mysql/pdo_mysql.ini

Since:

whereis  locates  the  binary,  source  and  manual  files for the specified command names.  The supplied names are first
       stripped of leading pathname components and any (single) trailing extension of the form .ext (for example:  .c)  Prefixes
       of  s.   resulting from use of source code control are also dealt with.  whereis then attempts to locate the desired pro‐
       gram in the standard Linux places, and in the places specified by $PATH and $MANPATH.

and php-mysql is not a command your output is as expected. If you were to try an actual command such as phpquery that is installed when you install php-mysql

You would get:

$ whereis phpquery
phpquery: /usr/sbin/phpquery

TL;DR

What should have happened when you installed php-mysql is all of these packages should have been installed. If as you say it's not installed you can

sudo apt-get install php-common php7.0-common php7.0-mysql to install all the packages that the php-mysql meta package installs.

Sources:

https://packages.ubuntu.com

man whereis

Elder Geek
  • 36,023
  • 25
  • 98
  • 183