Jump to content

includes


topcoder1

Recommended Posts

I have 3 files Index.php, x.php and  login/Login.php

in Login.php

<?php require_once "../x.php"; ?>

 

Index.php

<?php require_once "login\Login.php"; ?>

 

when executing Index.php error is Failed opening required '../x.php'

I can of course say <?php require_once "x.php" ?> in Login.php, then Index.php would load fine.. However if I load login\Login.php independently, x.php would not be found.

 

So what should I do?

 

 

Link to comment
Share on other sites

Best to use absolute paths, you can use $_SERVER['DOCUMENT_ROOT'] as a starting point.

 

thanks but if I create a config.php that sets my app file root, then I need to include that config.php as well... this problem becomes circular.. might as well put everything under the app root...

there has to be a simple solution right?  I searched for a while and not able to find one...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.