You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

phpMyAdmin导入功能count报错及修改后500错误求助

Fixing phpMyAdmin Import Warning & Post-Modification 500 Error (PHP 7.2, Ubuntu 18.04)

Hey there, let's work through this phpMyAdmin issue step by step—since you can't upgrade PHP, we'll focus on safe, compatible fixes to get you back up and running, plus an emergency export option if you need it right now.

Step 1: Rollback the Broken Code Change to Fix the 500 Error

First, let's undo the edit you made to ./libraries/plugin_interface.lib.php that triggered the 500 internal server error. That direct array cast likely introduced an unexpected type conflict.

  • Access your server via SSH or a file manager
  • Navigate to the phpMyAdmin libraries directory (typically /usr/share/phpmyadmin/libraries/ on Ubuntu 18.04)
  • Open plugin_interface.lib.php and revert the line you modified back to its original state:
    if ($options != null && count($options) > 0)
    
  • Restart Apache to apply the rollback:
    sudo systemctl restart apache2
    

This should bring phpMyAdmin back online immediately.

Step 2: Fix the Original count() Warning (PHP 7.2 Compatibility)

The initial warning happens because PHP 7.2 tightened rules for the count() function—it only accepts arrays or objects that implement the Countable interface. The $options variable might sometimes be a non-countable value (like null or a scalar). Instead of the problematic array cast, use a safer, version-compatible check:

  • Edit plugin_interface.lib.php again, replacing the line with this:
    if ($options != null && (is_array($options) || $options instanceof Countable) && count($options) > 0)
    

This first verifies $options is either an array or a countable object before calling count(), which aligns with PHP 7.2's requirements without breaking the code.

  • Restart Apache once more to apply the fix:
    sudo systemctl restart apache2
    

Step 3: Emergency Database Export Alternative (If phpMyAdmin Still Acts Up)

If you need to export your database immediately and don't want to mess with phpMyAdmin code further, use the command-line mysqldump tool—it's reliable, bypasses phpMyAdmin's PHP compatibility issues, and works perfectly with your MariaDB 10.1 setup:

  1. Run this command, replacing the placeholders with your actual database credentials:
    mysqldump -u [your_db_username] -p [your_database_name] > /path/to/save/exported_database.sql
    
  2. When prompted, enter your database password.
  3. The SQL export file will be saved to the path you specified—you can download it via SFTP or your server's file manager.

内容的提问来源于stack exchange,提问作者John Durchak

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.06 11:12:36