Reputation: 6659
I am dealing with a strange PHP issue.
In my script, I have the following:
$includeRoot = '/home/mydomain/include/';
include_once $includeRoot."table_names.inc";
echo $usersTbl;
The output produces nothing. $usersTbl is defined in table_names.inc as follows:
$usersTbl = 'users';
This code works fine in another script. I tried the following:
Changing include_once to require_once
The problem does not seem to be that the code cannot find the file. If I do the following:
echo (file_get_contents($includeRoot."table_names.inc"));
it actually echoes out the file contents. What am I not seeing here?
Upvotes: 0
Views: 2181
Reputation: 21
To help debug the issue, try the following:
if( file_exists( $includeRoot . "table_names.inc" ) ) {
die( "Include file exists!" ) ;
} else {
die( "Include file does not exist!" ) ;
}
That will at least tell you if the file and filepath actually exist. If the file does exist then the problem may be in your actual include file. If it doesn't exist, then double check your path.
You may also want to make sure error reporting is completely on and dumping to the screen:
error_reporting(E_ALL);
ini_set('display_errors','On');
Upvotes: 2