Failed to open stream: No such file or directory



I can't seem to get this file to open in php:

My folder structure is as follows:

/home/www/site/user/index.php

/home/www/site/lib/login.inc.php

I am trying to open login.inc.php in the user index.php file:

if (!defined('SITE_ROOT') || !defined('USER_ROOT') )
{
define('SITE_ROOT', '../');
define('USER_ROOT', './');
}

require_once SITE_ROOT . 'lib/login.inc.php';

But this keeps coming up with a failed to open stream error.



Try using use $_SERVER['DOCUMENT_ROOT'] instead of any other variable to find the root of the file.