phpMyAdmin and PHP 7 issues

Problem with phpMyAdmin and PHP 7.2: “Warning in ./libraries/sql.lib.php#613 count(): Parameter must be an array or an object that implements Countable”

Last updated on

It’s possible that when you installed phpMyAdmin, the version in the repository (phpMyAdmin v4.6.6) was not fully compatible with PHP 7.2. There is a newer version available on the official website (v4.8 as of writing), which fixes these compatibility issues with PHP 7.2.

This error is caused by a line of code in /usr/share/phpmyadmin/libraries/sql.lib.php.

If you don’t want to wait for the repositories to update with the latest version, you can manually upgrade to the latest version of phpMyAdmin yourself.

Alternatively, you can make a small change to sql.lib.php to fix the error.

Firstly, backup sql.lib.php before editing.

sudo cp /usr/share/phpmyadmin/libraries/sql.lib.php /usr/share/phpmyadmin/libraries/sql.lib.php.bak

Edit sql.lib.php in nano.

sudo nano /usr/share/phpmyadmin/libraries/sql.lib.php

Press CTRL + W and search for (count($analyzed_sql_results['select_expr'] == 1)

Replace it with ((count($analyzed_sql_results['select_expr']) == 1)

Save file and exit. (Press CTRL + X, press Y and then press ENTER)

Note that this is just a temporary fix and other compatibility issues may crop up until you update phpMyAdmin to the latest version.

If you are also getting an error Warning in ./libraries/plugin_interface.lib.php#551 under import and export tabs, see comments below.

Let me know in the comments if this helped. Follow me @DevAnswers or read more.

1 Star2 Stars3 Stars4 Stars5 Stars 4.90 (68 votes)

Feedback

Your email address will not be published. Required fields are marked *

We use Markdown to style comments, like on Github and Reddit.
To do a line break, type two spaces after the sentence.
You can add inline code by wrapping it in backticks: `code here`

    To do an entire block of code  
    type four spaces before the line
    and it will appear in a block like this.
    <-- four empty spaces

71 replies

Solved the problem with ubuntu 18.04 nginx php7.2-fpm phpmyadmin 4.6.6.
Thank you!!!

it help me a lot but after this solution i am facing count () function is not working with group by . hosting to Digital Ocean Droplet where
OS is Ubuntu 18.04,
Apache2,
PHP 7.2,
Tomcat 9,
MySQL 5.7 ,
PhpMyAdmin 4.8.
but same program is working in another hosting (not VPS) which is running.
will you give me guideline ?

I seem to have errors in phpmyadmin. I get Warning in ./libraries/plugin_interface.lib.php#551 under import and export tabs. I have done above 🙁

Backup plugin_interface.lib.php

sudo cp /usr/share/phpmyadmin/libraries/plugin_interface.lib.php /usr/share/phpmyadmin/libraries/plugin_interface.lib.php.bak

Edit plugin_interface.lib.php

sudo nano /usr/share/phpmyadmin/libraries/plugin_interface.lib.php

Press CTRL + W and search for

if (! is_null($options) && count($options) > 0) {

Replace with

if ($options != null) {

Save file and exit. (Press CTRL + X, press Y and then press ENTER)

I ended up taking a complete back flip. I worked out what i did wrong. I set up the database users incorrectly and wouldn’t connect. I ended up using a raspberry pi instead of laptop. Easier to make backups or repair if it goes down. I have found your posts very handy. thanks

if not found: if (! is_null($options) && count($options) > 0) {

please search: if ($options != null && count($options) > 0) { and … It works.

Hi, thanks for the article and this comment. When I tried this, the section of the screen is blank. There is nothing in the section that has the import options.

please try if ($options != null) {

Carefull for some of us does changing this setting isn’t working, You get Blank Page, follow the steps @Ardhia Mangku Ikhsan Provided.

Great! Hopefully the repositories will update with the latest version of phpMyAdmin soon.