Page 1 of 1

Strange require_once(config.inc.php)

Posted: Wed Feb 04, 2009 2:53 pm
by cjswanson1355
Hello. Right now I am trying to set up a mail server, and I am having a heck of a time with this file. I did not write this, and I am completely baffled by this line of code.

require_once("config.inc.php");

This file does not exist in the directory, and when I check a working version of the program, it does not exist in the directory as well. Where else could require_once be pulling information from? A PHP extension I am not aware of? I am guessing it is related to pear but I really do not understand the libraries.

This is the error code it spits out

Warning: require_once(config.inc.php) [function.require-once]: failed to open stream: No such file or directory in /var/www/html/******/********/index.php on line 25

Fatal error: require_once() [function.require]: Failed opening required 'config.inc.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/******/********/index.php on line 25

Re: Strange require_once(config.inc.php)

Posted: Wed Feb 04, 2009 2:58 pm
by John Cartwright
PHP has something called an include path, where you can predefine the directories where PHP should attempt to load the file from, i.e. PEAR.

Take a look at

Code: Select all

echo get_include_path();

Re: Strange require_once(config.inc.php)

Posted: Wed Feb 04, 2009 2:59 pm
by Benjamin
Can you post the code above that line please? Also, is this file included by a different file? For example:

index.php
config.inc.php
/includes/somefile.php

If you request index.php, the current directory is / (for the purposes of this example). Now if index.php includes includes/somefile.php, this does not change the current working directory. somefile.php could then include config.inc.php without error.

Re: Strange require_once(config.inc.php)

Posted: Wed Feb 04, 2009 3:03 pm
by cjswanson1355
The only code above that line is some documentation. and the start php header. This is pulling from a different file.

Re: Strange require_once(config.inc.php)

Posted: Wed Feb 04, 2009 3:06 pm
by John Cartwright
You didn't address my response to the include path, nor to whether the file is being included from another page. :?

Re: Strange require_once(config.inc.php)

Posted: Wed Feb 04, 2009 3:10 pm
by cjswanson1355
So after echoing the include path i get

/usr/share/pear:/usr/share/php'

Am I correct in assuming I need to create this directly and get the config file from my admin and put in in there.

Re: Strange require_once(config.inc.php)

Posted: Wed Feb 04, 2009 3:40 pm
by cjswanson1355
n/m, I found out i need to access the webpage through a region.