Jump to content

PHP and root?


Manixat

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
https://forums.phpfreaks.com/topic/276627-php-and-root/
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

Link to comment
https://forums.phpfreaks.com/topic/276627-php-and-root/#findComment-1423342
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.