PhpMyAdmin 4.7 on Opensuse Leap 42.2 – install PHP 7 and correct some code to avoid errors

Yesterday, I wanted to change to the latest version of PhpMyAdmin (4.7) on my development laptop which runs on Opensuse Leap 42.2. PHP 5.6 was provided via an Apache2 server and php-apache-modules. I downloaded the zipped code package for PhpMyAdmin and performed the usual setup procedure on my local web server. But I met some obstacles both under and after the phpmyadmin installation.

First, I got an error during installation of the following type:

phpmyadmin fatal error: call to undefined function phpseclib\crypt\random::string() in …/phpmyadmin/libraries/config/serverconfigchecks.php on line 226

Changing to PHP 7 – via using the Opensuse repository at http://download.opensuse.org/repositories/devel:/languages:/php/openSUSE_Leap_42.2/ helped to overcome this error.

However, be aware of the fact that changing to PHP 7 globally implies a lot of consequences – e.g changing database code in older programs from the the “mysql” to the “mysqli” interface. (Off topic: As long as one wants to use PHP via Apache modules I do not see a way to run both PHP versions in parallel on one Apache2 web server. Things are different with FCGI and PHP-FPM; but I did not experiment with these alternatives, yet. My way to support older programs for the time being actually includes the use of an independent 42.2 LAMP installation on a KVM machine – together with an older 4.3/4.4-version of PhpMyAdmin.]

Another error I stumbled across after installation of PhpMyAdmin 4.7 occured when I tried to use the drop-down boxes for changing pages during the display of large tables. Whenever you use the drop down box a small popup appears complaining about “unmatching tokens”.

The recipe to mend this bug is described by the Phpmyadmin developers on the following Internet page:
https://github.com/phpmyadmin/phpmyadmin/commit/5ee4320b7de345062ced7e02aca65417baa8a944

One just has to change some lines (at line nr 796) in the file “/InstallationDirOFPhpmyadminOnWebserver/libraries/DisplayResults.php” as described in the above article :

// Comment the following lines at position 796 and replace with the 2 lines shown 
// $table_navigation_html .= '<form action="sql.php'
// . URL::getCommon($_url_params)
// . '" method="post">';
$table_navigation_html .= '<form action="sql.php" method="post">';
$table_navigation_html .= URL::getHiddenInputs($_url_params);

Good luck with PhpMyAdmin 4.7!