Today, I had installed PHP 7.3 and phpMyAdmin on Ubuntu 18.04 LTS system. I am using MariaDB as database server running on the same instance. When I tried to access data in tables using phpMyAdmin got the following error message on screen.
Warning in ./libraries/sql.lib.php#613 count(): Parameter must be an array or an object that implements Countable”
It looks issue is due to older version of phpMyAdmin. The version of phpMyAdmin is older before the release of PHP 7.3 and it not properly compatible with that.
In order to resolve, we recommend to upgrade the phpMyAdmin version. But you can make changes in sql.lib.php to temporarily resolve this error.
- Make a backup of sql.lib.php
sudo cp /usr/share/phpmyadmin/libraries/sql.lib.php /usr/share/phpmyadmin/libraries/sql.lib.php.bak
- Next, edit sql.lib.php in your favorite text editor:
sudo nano /usr/share/phpmyadmin/libraries/sql.lib.php
- Press CTRL + W and enter string
(count($analyzed_sql_results['select_expr'] == 1)to search.
Then, replace it with
((count($analyzed_sql_results['select_expr']) == 1)
- Save file and exit. (Press CTRL + X, press Y and then press ENTER).
All done. The error message should disappear now.