?
Solved

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

Posted on 2009-04-20
3
Medium Priority
?
8,420 Views
Last Modified: 2013-11-10
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

0
Comment
Question by:yami_rider
3 Comments
 
LVL 4

Accepted Solution

by:
blaaze earned 750 total points
ID: 24191004
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
 
LVL 14

Assisted Solution

by:shobinsun
shobinsun earned 750 total points
ID: 24191097
Hi,

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

0
 

Author Comment

by:yami_rider
ID: 24191784
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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses
Course of the Month15 days, 12 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question