When count(): Parameter must be an array or an object that implements Countable Error Occurs in phpMyAdmin, What to Do?

Mary-Kate Olsen
Release: 2024-10-20 12:56:30
Original
557 people have browsed it

When count(): Parameter must be an array or an object that implements Countable Error Occurs in phpMyAdmin, What to Do?

Parameter Must be an Array or an Object that Implements Countable

Question:

When attempting to open a table in phpMyAdmin, you may encounter the following error:

count(): Parameter must be an array or an object that implements Countable

This can be a perplexing issue, especially since it originates within the phpMyAdmin interface.

Answer:

The error stems from a mismatch between phpMyAdmin and the underlying PHP version (7.2) on Ubuntu 16.04. To resolve this issue, follow these steps:

  1. Edit the /usr/share/phpmyadmin/libraries/sql.lib.php file using the command:

    sudo nano +613 /usr/share/phpmyadmin/libraries/sql.lib.php
    Copy after login
  2. On line 613, replace the following code:

    ((empty($analyzed_sql_results['select_expr']))
     || (count($analyzed_sql_results['select_expr'] == 1)
         && ($analyzed_sql_results['select_expr'][0] == '*')))
    Copy after login

    with this corrected code:

    ((empty($analyzed_sql_results['select_expr']))
     || (count($analyzed_sql_results['select_expr']) == 1)
         && ($analyzed_sql_results['select_expr'][0] == '*'))
    Copy after login
  3. Additionally, delete the last closing parenthesis on line 614.
  4. Finally, restart the Apache server:

    sudo service apache2 restart
    Copy after login

This adjustment will align the count function with the PHP 7.2 syntax, preventing the error from occurring in phpMyAdmin.

The above is the detailed content of When count(): Parameter must be an array or an object that implements Countable Error Occurs in phpMyAdmin, What to Do?. For more information, please follow other related articles on the PHP Chinese website!

source:php
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!