How to Fix \'count(): Parameter Must be an Array or an Object that Implements Countable\' Error in phpMyAdmin?

DDD
Release: 2024-10-20 12:54:30
Original
561 people have browsed it

How to Fix

phpMyAdmin Error: "count(): Parameter Must be an Array or an Object that Implements Countable"

Have you encountered an error with phpMyAdmin stating "Warning in ./libraries/sql.lib.php#601ncount(): Parameter must be an array or an object that implements Countable"? Let's delve into the issue and provide a solution.

Cause of the Error:

The error arises from line 601 of the sql.lib.php file within the phpMyAdmin installation. This line checks if the variable $analyzed_sql_results['select_expr'] is an empty array or if it contains a single asterisk (*). However, due to a missing closing parenthesis, the count function always returns true, leading to the error.

Troubleshooting and Solution:

  1. Edit the File:

    • Use the following command to open the file: sudo nano 613 /usr/share/phpmyadmin/libraries/sql.lib.php
  2. Locate Line 613:

    • This line contains the erroneous count function.
  3. Make the Replacement:

    • Replace the following section:
      ((empty($analyzed_sql_results['select_expr']))
      || (count($analyzed_sql_results['select_expr'] == 1)

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

         && ($analyzed_sql_results['select_expr'][0] == '*'))
      
      Copy after login
  4. Remove Extra Parenthesis:

    • On line 614, remove the last closing parenthesis: )
  5. Restart Apache:

    • Execute the following command: sudo service apache2 restart

These steps should resolve the issue and eliminate the "count(): Parameter must be an array or an object that implements Countable" error within phpMyAdmin.

The above is the detailed content of How to Fix \'count(): Parameter Must be an Array or an Object that Implements Countable\' Error in phpMyAdmin?. 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
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!