Error On phpMyAdmin

November 1, 2018 3.5k views
Apache PHP MySQL Ubuntu 18.04

I keep getting this error before I import a database:

in ./libraries/plugin_interface.lib.php#551
count(): Parameter must be an array or an object that implements Countable

Backtrace

./libraries/display_import.lib.php#371: PMA_pluginGetOptions(
string 'Import',
array,
)
./libraries/display_import.lib.php#456: PMA_getHtmlForImportOptionsFormat(array)
./libraries/display_import.lib.php#691: PMA_getHtmlForImport(
string '5bdb3279a72ae',
string 'database',
string 'chihenne',
string '',
integer 16777216,
array,
NULL,
NULL,
string '',
)
./db_import.php#43: PMA_getImportDisplay(
string 'database',
string 'chihenne',
string '',
integer 16777216,
)

The import works fine after I select "Ignore", but what can I do to remove this error?

3 Answers

I guess you are using Ubuntu 18.04 with PHP 7.2.
The error happens because there is compatibility issue.
The best way to fix the problem is to manually upgrade phpMyAdmin no new version.

You can also fix this by editing the library itself.

  1. Make a backup first
    sudo cp /usr/share/phpmyadmin/libraries/plugininterface.lib.php /usr/share/phpmyadmin/libraries/plugininterface.lib.php.bak

  2. Edit the library
    sudo nano /usr/share/phpmyadmin/libraries/plugin_interface.lib.php

  3. Search for "if (! is_null($options) && count($options) > 0) {"
    or if not found then search for "if ($options != null && count($options) > 0) {"

Then replace it with "if ($options != null) {"

To search in Nano editor press CTRL and W

  1. Save the file (CTRL and O)

  2. Refresh the phpMyAdmin page and try agin.

I followed step 1 and it says that file doesn't exist :/

  • cp /usr/share/phpmyadmin/libraries/plugininterface.lib.php /usr/share/phpmyadmin/libraries/plugininterface.lib.php.bak

It's missing the underscore- WHICH is deleted by this editor (why? why?) Try this instead:
sudo cp /usr/share/phpmyadmin/libraries/plugin _ interface.lib.php /usr/share/phpmyadmin/libraries/plugin _ interface.lib.php.bak
without the SPACES around the UNDERSCORE

After testing it on PHP 7.2.10 you need to change that line like this:
if ($options != null && count(array($options)) > 0) {

This solved both the LOAD error and the EXPORT error w Ubuntu 18.04 for me.

Have another answer? Share your knowledge.