Jump to content

DOCUMENT_ROOT


kr3m3r

Recommended Posts

Hi guys,

I'm working on learning php, and the book I'm working with has me currently working on reading and writing to files.  I don't know too much about servers and how they are set up, which leads me to this question:

I'm told to use this line:

 

  $DOCUMENT_ROOT = $HTTP_SERVER_VARS['DOCUMENT_ROOT'];

 

to set the place where I'll be storing my documents.

Also, I use this code:

 

  @ $fp = fopen("$DOCUMENT_ROOT/../orders/orders.txt", 'a');

 

to open the file I'll write to.

 

I'm using my school servers which have supported my php code so far, but now I can't seem to do any of the file work I'd like to do for this assignment.  On the school servers I'm given space to store files in my own chunk of memory.  I've got a couple of folders for class, plus my public_html folder, where i store my website work.  Is there away to create a new folder called orders at the same level as the public_html folder, and access that for reading, writting, and creating new order.txt files? if so, how do i specify that location?

 

Thanks alot for your time.

-Robb

 

ps, I'd just like to take a second and thank you all for your help, this is by far the best website I've ever encountered for learning a new language.

Link to comment
https://forums.phpfreaks.com/topic/62980-document_root/
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.