Jump to content

Ok, what's the secret?


fishdish

Recommended Posts

I am very new to php. Working in html everything is about the url path. From what I can understand, php uses root directories for at least some parts of its script. What I am not understanding is how I find the root dorectory and write it correctly to be understood by php script.

 

Can someone please help me?

 

Link to comment
https://forums.phpfreaks.com/topic/143345-ok-whats-the-secret/
Share on other sites

You're looking for the directory to make file paths relevant to?

 

So you have a webpage called example.com.  In your DNS management system you link example.com to your server in the folder called public_html.  When you navigate to example.com php bases all links off of that public_html folder.

 

Now say you navigate to example.com/folder/subfolder/file.php.  Any relative paths in file.php are relative to public_html/folder/subfolder.

 

Does that help?  Or did I misread the question?

 

EDIT:

 

P.S. The variable $_SERVER["DOCUMENT_ROOT"] should link to the public_html folder from the above example.  The document root, or the lowest level folder in the directory tree.

Link to comment
https://forums.phpfreaks.com/topic/143345-ok-whats-the-secret/#findComment-751831
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.