I've got a PHP script that includes ( or 'requires' ) a set of other scripts. This is effectively for importing all of my classes. What I'm encountering is an HTTP 500 error. I've sifted through and commented out code piece by piece to determine that it's failing on the require_once in one of my files.
Here is the code:
index.php:
<?php
require_once("std/classes.php");
?>
And std/classes.php:
<?php
RequireStandards();
RequireAddons();
function RequireStandards( )
{
$ClassFiles = scandir("classes/standard");
foreach( $ClassFiles as $ClassFile )
{
if( $ClassFile == "." || $ClassFile == ".." )
continue;
//require_once("classes/standard/" . $ClassFile );
}
}
function RequireAddons()
{
$ClassFiles = scandir("classes");
foreach( $ClassFiles as $ClassFile )
{
if( $ClassFile == "." || $ClassFile == ".." || $ClassFile == "standard" )
continue;
//require_once("classes/" . $ClassFile );
}
}
?>
This code will work as it sits, but as soon as I uncomment the requires, it fails. What strikes me as odd is that I have plenty of other sites on this server that act in almost an identical manner.
I feel as if I somehow have my PHP error reporting turned off... which I don't know how to turn back on; as I just upgraded to PHP 5.3. I would typically expect a 'couldnt open file' or some such in my browser, if PHP failed.
Maybe someone could tell me why this is kicking back an HTTP 500, or perhaps just how to re-enable error reporting. It would be much appreciated; this just doesn't seem to make much sense.
To enable error reporting:
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once("std/classes.php");
?>
Hopefully that should work.
EDIT: If this does work, remember to turn off display errors before putting anything in a live, public facing environment!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With