<?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..