kr3m3r Posted August 2, 2007 Share Posted August 2, 2007 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 More sharing options...
cooldude832 Posted August 2, 2007 Share Posted August 2, 2007 what version of php is this book, secondly do not use the @ its an operator to supress error messages and makes it hard to learn php, its only meant for professional projects where if it errors no message should be shown. Link to comment https://forums.phpfreaks.com/topic/62980-document_root/#findComment-313636 Share on other sites More sharing options...
kr3m3r Posted August 2, 2007 Author Share Posted August 2, 2007 The book is good through php 4.2, i think, it was published in 2003, it is: PHP and MySQL Web Development 2nd edition. written by Luke Welling, and Laura Thompson. The problem suggests the use of the '@' symbol as part of creating a custom error message. Thanks. Link to comment https://forums.phpfreaks.com/topic/62980-document_root/#findComment-313652 Share on other sites More sharing options...
cooldude832 Posted August 2, 2007 Share Posted August 2, 2007 reason i ask is http_server_vars is old its now called $_SERVER also you will prorbably see http_get_vars is now $_GET and same for post and sessions Link to comment https://forums.phpfreaks.com/topic/62980-document_root/#findComment-313671 Share on other sites More sharing options...
kr3m3r Posted August 2, 2007 Author Share Posted August 2, 2007 yeah, I know that the old format has been depricated, but it is still valid, and I've used that style on this system with no problems before. My biggest problem is still trying to figure out how to tell the program where to look for and write the text file. Link to comment https://forums.phpfreaks.com/topic/62980-document_root/#findComment-313700 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.