Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

require_once and include location

Status
Not open for further replies.

hunterdw

Technical User
Oct 25, 2002
345
US
Hi there--

i have recently taken over management of a webserver. I am trying to move several sites from one to server to another.

One area where I'm stumped relates to include files.

I've got several thousand PHP files across many folders... some of them have a "require_once('config.inc');" statement and others have a "require_once('/include/config.inc');" statement.

There is only one config.inc file.

How can I configure my box so that 'config.inc' and '/include/config.inc' point to the same place?

The last person who hosted this site will not provide any configurations, so I'm trying to rebuild as best as my knowledge allows.

Help please.

--DW
 
Both the statements i.e. require_once('config.inc') and require_once('/include/config.inc'), possibly pointing to the same file i.e.config.inc. Check the locations of the files in which config.inc is included. May be the first one is given relative path (path of file with respect the the file calling) and the second one absolute path( the path from the web server root).



--------------------------------------------------------------------------
I never set a goal because u never know whats going to happen tommorow.
 
Yeah, that's what I thought first, but it's not the case.

the config.inc files are not anywhere in the webroot

they are somewhere else

in php.ini you can set an include path, so, if i place config.inc in that include path, I can just do a "require_once('config.inc') and all is well

I'm stumped on how '/include/config.inc' is the same as 'config.inc'

there is no folder in the webroot called include

and, even if I put a folder call "include" inside my "include path" and place config.inc inside it, it does not work...

I dont' have time to change 5000+ files to reflect 'config.inc' versus '/include/config.inc'

any other ideas?
 
The config.inc may be out of web server root to maintain security.
Are there any symbolic links to the file?

Are there any errors showing in the existing site about require_once() ?



--------------------------------------------------------------------------
I never set a goal because u never know whats going to happen tommorow.
 
no errors in current site

yes, I'm convinced the config.inc is out of the webroot

again, I have the config.inc file

I'm trying to find the best place to put it so that require_once('config.inc') and require_once('/include/config.inc') both point to the same place.

One config.inc file - two ways to get to it.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top