phpmyadmin - count(): Parameter must be an array o

2019-01-16 00:51发布

I've uploaded the backup to a table, opening the table I see this:

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

Backtrace

./libraries/sql.lib.php#2038: PMA_isRememberSortingOrder(array)
./libraries/sql.lib.php#1984: PMA_executeQueryAndGetQueryResponse(
array,
boolean true,
string 'alternativegirls',
string 'tgp_photo',
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
string '',
string './themes/pmahomme/img/',
NULL,
NULL,
NULL,
string 'SELECT * FROM `tgp_photo`',
NULL,
NULL,
)
./sql.php#216: PMA_executeQueryAndSendQueryResponse(
array,
boolean true,
string 'alternativegirls',
string 'tgp_photo',
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
string '',
string './themes/pmahomme/img/',
NULL,
NULL,
NULL,
string 'SELECT * FROM `tgp_photo`',
NULL,
NULL,
)
./index.php#53: include(./sql.php)

Inside phpMyAdmin...

PHP is 7.2, the server is Ubuntu 16.04, installed yesterday.

Looking for I saw that some have this error in their code, but I did not find anyone who received it in phpMyAdmin...

What should I do? Is that my error? A phpmyadmin error? wait update ? I go back to PHP 7.1?

23条回答
Viruses.
2楼-- · 2019-01-16 01:28

I think the best option is to update Phpmyadmin to a versión which has this already fixed.

Until it is published as a deb, you could do it like in @crimson-501 answer which I will copy below:

  • Your first step is to install PMA (phpMyAdmin) from the official Ubuntu repo: apt-get install phpmyadmin.
  • Next, cd into usr/share directory: cd /usr/share.
  • Third, remove the phpmyadmin directory: rm -rf phpmyadmin.
  • Now we need to download the latest PMA version onto our system (Note that you need wget: apt-get install wget): wget -P /usr/share/ "https://files.phpmyadmin.net/phpMyAdmin/4.8.2/phpMyAdmin-4.8.2-english.zip" Let me explain the arguments of this command, -P defines the path and "the link.zip" is currently (7/17/18) the latest version of PMA. You can find those links HERE.
  • For this next step you need unzip (apt-get install unzip): unzip phpMyAdmin-4.8.2-english.zip. We just unzipped PMA, now we will move it to it's final home.
  • Lets use the cp (copy) command to move our files! Note that we have to add the -r argument since this is a folder. cp -r phpMyAdmin-4.8.2-english phpmyadmin.
  • Now it's time to clean up: rm -rf phpMyAdmin-4.8.2-english.

Keep Reading!

You might now notice two errors after you log into PMA.

the configuration file now needs a secret passphrase (blowfish_secret). phpmyadmin
The $cfg['TempDir'] (./tmp/) is not accessible. phpMyAdmin is not able to cache templates and will be slow because of this.

However, these issues are relatively easy to fix. For the first issue all you have to do is grab your editor of choice and edit /usr/share/phpmyadmin/config.inc.php but there's a problem, we removed it! That's ok, all you have to do is: cd /usr/share/phpmyadmin & cp config.sample.inc.php config.inc.php.

Example phpMyAdmin Blowfish Secret Variable Entry:

/*
 * This is needed for cookie based authentication to encrypt password in
 * cookie
 */
$cfg['blowfish_secret'] = '{^QP+-(3mlHy+Gd~FE3mN{gIATs^1lX+T=KVYv{ubK*U0V'; 
/* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

Now save and close the file.

  • Now we will create a tmp directory for PMA: mkdir tmp & chown -R www-data:www-data /usr/share/phpmyadmin/tmp. The last command allows the Apache web server to own the tmp directory and edit it's contents.
查看更多
可以哭但决不认输i
3楼-- · 2019-01-16 01:30

Upgrade to phpMyAdmin 4.8.3. this solves the PHP 7.2 compatibility issues

查看更多
成全新的幸福
4楼-- · 2019-01-16 01:31

There is no need to use count if it is has single value or not because this is issue in first place. You can read more about it here http://php.net/manual/en/function.count.php

Now count will not work on NULL, Boolean, String, Integer. This is the reason here and you have to only replace the count with empty.

Check out what I did

&& ((empty($analyzed_sql_results['select_expr']))
        || (!empty($analyzed_sql_results['select_expr'])
            && ($analyzed_sql_results['select_expr'][0] == '*')))
查看更多
兄弟一词,经得起流年.
5楼-- · 2019-01-16 01:31

In my case (Ubuntu 18.04), the solutions above did not work. I did not understand why. Then I noticed I also had several other warning messages. After some investigation, I found out my PHP version (7.2) was not compatible with my PHPMyAdmin version. So all what I did was to upgrade the later one (version 4.8.4).

查看更多
SAY GOODBYE
6楼-- · 2019-01-16 01:34

Ubuntu 18.10 (December, 2018)

Line 613, 614, 615, replace with:

        || count($analyzed_sql_results['select_expr']) == 1
            && ($analyzed_sql_results['select_expr'][0] == '*'))
    && count($analyzed_sql_results['select_tables']) == 1;
查看更多
登录 后发表回答