Reputation: 1467
I am working on local server, but I am having problem including files, even with full path given. eg, I have a file /home/[user]/public_html/vt/test.php
like this:
<?php
include_once('/home/<user>/public_html/vt/Menu.php');
print "included_once called.\n";
?>
I got error in error_log
:
failed to open stream: No such file or directory
/home/[user]/public_html/vt/Menu.php exists, and access right is:
-rwxr-xr-x. 1 <user> apache 3906 Jul 5 08:43 <full/path/of/the/file>
The local documentRoot folder is set to (recursively):
drwxr-xr-x. 4 <user> apache 4096 Jul 26 14:06 public_html
So what is wrong?
Upvotes: 0
Views: 54100
Reputation: 12655
try something like that: (DIR is a magic constant which contains the directory of the current file)
include_once dirname(__FILE__).'/Menu.php';
// PHP >= 5.3
include_once __DIR__.'/Menu.php';
Upvotes: 3