dptt66700 2017-03-12 21:24
浏览 24

为什么我得到“致命错误:不能在一个虚拟主机上重新声明funcName()”而不是另一个虚拟主机?

<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

include('inc/functions.php');
include('inc/functions.php');
include('inc/functions.php');

function funcName() {}

echo 'all done!';

inc/functions.php defines funcName.

I run that code on one virtual host and I get a Fatal error: Cannot redeclare funcName() error. I run it on another virtual host on the same server and I don't. In fact, I get an "all done!" message. inc/functions.php is the same on both servers. The .htaccess is the same on both servers. Both virtual hosts are running PHP 5.3.2 (which I waaay EOL, I am aware).

If I put in an echo in inc/functions.php the server that doesn't give me a fatal error outputs that echo statement 3x times, showing that that file is, in fact, being included 3x times.

APC is installed on the server if that helps. Since that does opcode cache'ing that maybe that was kinda masking the errors but if that were the case then it seems like clearing the APC cache would make the behavior more consistent but it doesn't..

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 vscode的问题提问
    • ¥50 切换TabTip键盘的输入法
    • ¥15 可否在不同线程中调用封装数据库操作的类
    • ¥15 微带串馈天线阵列每个阵元宽度计算
    • ¥15 keil的map文件中Image component sizes各项意思
    • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
    • ¥15 划分vlan后,链路不通了?
    • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
    • ¥15 Vue3 大型图片数据拖动排序
    • ¥15 Centos / PETGEM