Jump to content

PHP and root?


Manixat
Go to solution Solved by jcbones,

Recommended Posts

Hello freaks,

 

 

I have been unsuccessfully trying to manage PHP to begin a path from the root directory. I have a structure like so

 

/ < ROOT

 

/Project/Public/Index.php

/Project/Public/Images/Image.png

/Project/Framework/Class.php

 

 

Index.php includes class.php which checks if image.png exists via file_exists() and does stuff. The problem is that this

 

file_exists("/Project/Public/Images/Image.png")

returns bool(false) and in order to get a bool(true) i need to start from "Images/Image.png", but then if I call the class from somewhere else this wouldn't work, I suppose?

 

Link to comment
Share on other sites

The $_SERVER variables hold a lot of valuable information.  The document root is one of them.

 

You mean that I need to use the absolutely absolute path even beyond the htdocs folder?

 

EDIT: I never expected I would need to go any deeper than the htdocs but that worked! Thanks :P

Edited by Manixat
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.