Why doesn't this require_once statement find the file? (PHP) -


I'm not sure what's going on .. Maybe I left something easy.

In my connectvars.php file, I connect to the database using the variable in my config.php folder. Here is the hierarchy:

  Administrator (folder) contains config.php (folder) connectvars.php index.php  

I want to get information from the config Is php to use in connectvars.php, so i use: require_once ("../admin/config.php");
But every time I do this I get the warning: require_once (.. / admin / config) get php) [function.require-once]: failed to open the stream: at line 2 / home / a8879415 There is no such file or directory at /public_html/includes/connectvars.php

But when I type: need_once ("admin / config.php"); , it works

I thought I would have to go up one level, then go to the administrator, then get config.php so how do I just need to go to the admin folder Get config.php?

Are you running include / connectvars.php directly or does it Is included by other files?

I think that you are running index.php and this file is relatively inclusive of every file.

If you want to use relative paths to other files, then this can be done:

  need_once (dirname (__ FILE__). '/../ Admin / config.php ');  

Comments