Jump to content

Recommended Posts

Hi all,

 

Currently, I'm creating an application with a constant variable that I wish to use throughout the site. I can easily use the

include('thisfile.php');

but when I try to include the file from a lower directory like this

include ('thisfolder/thisfile.php');

it doesn't seem to work. I can include and open other files like .txt documents but jut not .PHP files. I've looked through the PHP settings but I cannot see any setting that would remotely relate to the problem I am having.

 

Any advice would be awesome at this point, I'm stumped.

If the directory is actually LOWER, that means it's DEEPER into the tree, and won't work.

 

Always use absolute paths starting from $_SERVER['DOCUMENT_ROOT'] so you don't have this issue.

 

Depends how you look at the tree. Hierarchical structures go top->bottom or left->right in most UIs.

 

windows-folder-view-modes.png

 

I always find myself clarifying this terminology with colleagues just to be sure. It goes both ways all the time I find.

Sorry if I wasn't clear about my directory issue. So far I cannot

include 

any file that isn't in the same directory as the file that is including it. For example: File path "/php/scripts/request.php" cannot include a file from "/php/scripts/morescripts/filetoinclude.php". I clearly remember being able to do this in  the past, so why aren't I able to now? I've fiddled around with "allow url include" but it still doesn't follow through.

 

Error I'm getting at the moment:

 

Warning: include(actions/clearverify.php?grade=11th): failed to open stream: No error in C:\wamp\stratus\apps\coursechange\admin\clear.php on line 16

 

Warning: include(): Failed opening 'actions/clearverify.php?grade=11th' for inclusion (include_path='.;C:\php\pear') in C:\wamp\stratus\apps\coursechange\admin\clear.php on line 16

 

Before I somehow got Error: The stream is currently unavailable, or something around that... I also can't seem to find any insight anywhere on the internet.

 

Thanks for the swift replies everyone!

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.