When only PHP 7.0 is installed on Ubuntu 16.04, PhpMyAdmin script install fails

When only PHP 7.0 is installed on Ubuntu 16.04, PhpMyAdmin script install fails

php7.0-mysql is installed on the system, but Virtualmin does not see it. and fails installation with:

PHP module mysql is required ..

    Installing package php5-mysql ..
    Installing package(s) with command apt-get -y -f install php5-mysql ..

    Reading package lists...
    Building dependency tree...
    Reading state information...
    Package php5-mysql 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-mysql' has no installation candidate

    .. install failed!
Status: 
Active

Comments

If you go to System Settings -> Re-Check Configuration, what PHP versions does Virtualmin detect?

Hi Jamie, It shows something strange:

The following PHP versions are available : 7.0.30 (/usr/bin/php5-cgi), 7.0.30 (/usr/bin/php-cgi7.0), 7.0 (mod_php)

PHP-FPM support is available on this system.

PHP versions have changed to 5, 7.0, 7.0 since last check. Regenerating any missing php.ini files.

And when looking at "Server Configuration" - "PHP Version" it shows choice of "7.0.30" and "7.0.30". But no PHP 5. And I don't want PHP 5 on that server anyway. Was now wondering from where it got the PHP 5 information above. And found it:

There are instructions on 14.04 to 16.04 upgrade here: https://www.virtualmin.com/documentation/system/os/ubuntu-trusty-to-xenial

to do a ln -s /usr/bin/php-cgi /usr/bin/php5-cgi

I removed then symbolic link, rechecked config and got correctly:

The following PHP versions are available : 7.0.30 (/usr/bin/php-cgi7.0), 7.0 (mod_php)

PHP-FPM support is available on this system.

PHP versions have changed to 7.0, 7.0 since last check. Regenerating any missing php.ini files.

That fixed the "bug" for installing PhpMyAdmin.

Then to remove the mod_php variant of PHP 7.0.30 without affecting running sites. Just uninstalled libapache2-mod-php7.0 to only leave the FPM variant, that fixed also the strange double-choice

For me, the issue I had is now solved. Thanks for pointing into the right direction.

So there is a main bug in the So the bug here is the wrong/outdated? Ubuntu 14.04->16.04 upgrade documentation here: https://www.virtualmin.com/documentation/system/os/ubuntu-trusty-to-xenial

And a minor UI bug in the double-7.0.30 dropdown that doesn't detail the difference of the 2 variants.

And somehow related, when upgrading phpmyadmin with PHP 7.2 by default, php 7.2 mcrypt is not a package anymore on Ubuntu 16.04 (and php, so on any other distribution). This makes the upgrade fail, but still marking it as upgraded, despite not downloading the new phpmyadmin version:

Installing in domain demetra.antimisiaris.com ..

    PHP module mcrypt is recommended ..
        Installing package php72-mcrypt ..
        Installing package(s) with command apt-get -y -f install php72-mcrypt ..

        Reading package lists...
        Building dependency tree...
        Reading state information...
        E: Unable to locate package php72-mcrypt

        .. install failed!

    Module is not available even after installation!

    Configuring webserver PHP settings ..
    .. already done.

    phpMyAdmin installation complete. It can be accessed at ...

Do you mean that there is no mcrypt package for PHP 7.2, or is Virtualmin just installing it with the wrong name?

Ok .. however, that message from the script install about the failure to install mcrypt doesn't cause the script to completely install, because it's just an optional dependency.