Reputation: 5737
At the moment I am in the following
/public_html/v3/football/admin/new.php
Inside that new.php, i want to include a file in the following place
/public_html/v3/include/session.php
I am having problems trying to include this, can someone help? please!
Upvotes: 0
Views: 61
Reputation: 61
require '../../include/session.php';
More info here: http://www.php.net/manual/en/function.include.php
Upvotes: 1
Reputation: 490233
You should define a base dir constant in a bootstrap type file...
// If >= PHP 5.3
define('BASE_DIR', __DIR__);
// Otherwise
define('BASE_DIR', realpath(dirname(__FILE__)));
And include files like so...
include BASE_DIR . 'admin/new.php';
This is handy, so you shouldn't have to traverse up directories - just supply paths relative to that constant.
If you insist, you should be able to include that session.php
with
require '/public_html/v3/include/session.php';
// or
require '../../include/session.php';
Upvotes: 1