PHP -- Warning: require_once(/includes/config.inc.php) [function.require-once]: failed to open stream: No such file or directory in

I have a major problem that seems to have no solution.

I am receiving this warning "Warning: require_once(/includes/config.inc.php) [function.require-once]: failed to open stream No such file or directory in /home/user/public_html/index.php on line 2" and this error "Fatal error: require_once() [function.require]: Failed opening required '/includes/config.inc.php' (include_path='.:') in /home/user/public_html/index.php on line 2"

1. The path to the website is /home/user/public_html AND the folder Includes is located within this location.
2. The website location IS accessible because I can point my browser to a test file www.testsite.com/index.html and it works.
3. SERVER["DOCUMENT_ROOT"] is set to /home/user/public_html


?php
	require_once($_SERVER["DOCUMENT_ROOT"] . "/includes/config.inc.php");
	require_once("$CFG->includesdir/general.inc.php");
	require_once("$CFG->includesdir/db_connect.inc.php");
	require_once("$CFG->includesdir/admin_support.inc.php");
	require_once("$CFG->includesdir/product_menu.php");
	require_once 'Pager/Pager.php';
?>

Open in new window

yami_riderAsked:
Who is Participating?
 
blaazeCommented:
If your allow_url_fetch variable must be on in your php.ini

then you need to give the absolute path of the root address
and then i can see a opening angular bracket is missing in your code, plz fix it and then have a try
<?php
        require_once($_SERVER["DOCUMENT_ROOT"] . "/includes/config.inc.php");
        require_once("$CFG->includesdir/general.inc.php");
        require_once("$CFG->includesdir/db_connect.inc.php");
        require_once("$CFG->includesdir/admin_support.inc.php");
        require_once("$CFG->includesdir/product_menu.php");
        require_once 'Pager/Pager.php';
?>

Open in new window

0
 
shobinsunCommented:
Hi,

You should have the file in that directory and also give the chmod 777 permission to that directory.

0
 
yami_riderAuthor Commented:
Ok I figured out what the problem was.  I am debugging my PHP code using the Eclipse Platform IDE w/Zend and I was debugging the files in "script" mode and not "web" mode therefore the environment variable SERVER_[DOCUMENT_ROOT] was not set.

Debugging the files using the Web mode set the variables and everything is running fine. To make the change I set Debug As --> PHP Web Page and that ensured the SERVER_[] variable was populated.

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.