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

Drupal 7迁移至XAMPP后出现ArgumentCountError错误求助

Drupal 7迁移XAMPP后PDO继承致命错误解决办法

错误信息

Fatal error: During inheritance of PDO: Uncaught ArgumentCountError: Too few arguments to function _drupal_error_handler(), 4 passed in C:\Users\anton\Desktop\Newxampp\htdocs\eirinika\includes\bootstrap.inc on line 2739 and exactly 5 expected in C:\Users\anton\Desktop\Newxampp\htdocs\eirinika\includes\bootstrap.inc:2589 Stack trace: #0 C:\Users\anton\Desktop\Newxampp\htdocs\eirinika\includes\bootstrap.inc(2739): _drupal_error_handler(8192, 'Return type of ...', 'C:\Users\anton\...', 1317) #1 C:\Users\anton\Desktop\Newxampp\htdocs\eirinika\includes\bootstrap.inc(2739): require_once() #2 C:\Users\anton\Desktop\Newxampp\htdocs\eirinika\includes\bootstrap.inc(2516): _drupal_bootstrap_database() #3 C:\Users\anton\Desktop\Newxampp\htdocs\eirinika\includes\bootstrap.inc(2658): drupal_bootstrap(3, false) #4 C:\Users\anton\Desktop\Newxampp\htdocs\eirinika\includes\bootstrap.inc(2512): _drupal_bootstrap_page_cache() #5 C:\Users\anton\Desktop\Newxampp\htdocs\eirinika\index.php(20): drupal_bootstrap(7) #6 {main} in C:\Users\anton\Desktop\Newxampp\htdocs\eirinika\includes\database\database.inc on line 187

问题根源

这个错误的核心是PHP版本兼容性问题:Drupal 7原生仅支持PHP 5.3.10到PHP 7.4,而XAMPP默认安装的新版本(比如PHP 8.0+)会触发PDO继承相关的语法错误,进而引发错误处理函数的参数不匹配问题。你之前调整的数据库配置不是核心原因。

解决步骤

  • 更换XAMPP的PHP版本至7.3或7.4
    下载对应版本的XAMPP(如XAMPP 7.4.x系列),替换当前环境;或单独替换XAMPP目录下的PHP组件,确保版本符合Drupal 7的要求。
  • 验证数据库配置正确性
    确保sites/default/settings.php中的数据库配置格式正确,XAMPP默认MySQL用户名是root,密码为空(若修改过则填对应值):
    $databases = array (
      'default' => 
      array (
        'default' => 
        array (
          'database' => '你的数据库名称',
          'username' => 'root',
          'password' => '',
          'host' => 'localhost',
          'port' => '3306',
          'driver' => 'mysql',
          'prefix' => '',
        ),
      ),
    );
    
  • 确认MySQL服务状态与数据库完整性
    启动XAMPP的MySQL服务,通过phpMyAdmin检查迁移的数据库表是否完整导入。
  • 清除Drupal缓存
    删除sites/default/files/cache目录下的所有缓存文件,避免旧缓存影响启动。

内容的提问来源于stack exchange,提问作者Antonis Emmanouilidis

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.10 01:35:19