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

Posted by ggfan on Stack Overflow See other posts from Stack Overflow or by ggfan
Published on 2010-05-15T17:45:10Z Indexed on 2010/05/15 17:54 UTC
Read the original article Hit count: 118

Filed under:

I not sure what's going on..maybe I missed something simple.

In my connectvars.php file, I connect to the database using the variables in my config.php folder. Here's the hierarchy:

admin(folder)
   config.php
includes(folder)
   connectvars.php

I want to get information from config.php to use in connectvars.php, so I use: require_once("../admin/config.php");
But everytime I do this I get Warning: require_once(../admin/config.php) [function.require-once]: failed to open stream: No such file or directory in /home/a8879415/public_html/includes/connectvars.php on line 2

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

I thought I had to go up a level, then go down to admin, then get config.php. So how come I just need to go into the admin folder then get config.php?

© Stack Overflow or respective owner

Related posts about php