I bought this great book yesterday. PHP and MySql Web Development by Luke Welling and Laura Thomson. I am currently on Chapter 2 making Bob's Auto Parts order form.
Using the code exactly as it is in the book, I am getting the following error.
Warning: fopen(c:/program files/apache group/apache/htdocs/../orders/orders.txt) [function.fopen]: failed to open stream: No such file or directory in c:\program files\apache group\Apache\htdocs\bobsautoparts\processorder.php on line 64
Since I know its not a coding problem, I am now at a loss as to why this will not work. Here are some code snippets from the book which are causing this error..
$DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT'];
// more code in here of course but not needed for this question
$fp = fopen("$DOCUMENT_ROOT/../orders/orders.txt", 'ab'); // this is line 64
From my phpinfo page here is the _SERVER["DOCUMENT_ROOT]" info...
c:/program files/apache group/apache/htdocs
In my apache error.log file it is stating this...
[Sat Apr 02 10:34:23 2005] [error] [client 127.0.0.1] File does not exist: c:/program files/apache group/apache/htdocs/bobsautoparts/function.fopen
If more information is needed please let me know....
I am running windows xp pro with all the latest updates and patches
php version 5.04
Apache (as a module) 1.3.33
The php and apache are setup exactly as instructed from the book and all seems to be working as it should. It seems as though I have a permission problem maybe but I do not know how to overcome this in windows. In unix I understand you can chmod 777 or something like that, but that is not an option in windows.
Can someone help me figure out why this is happpening to me?
According to the book, this is suppose to create the file orders.txt in the folder orders, two subdirectories up from the document root. And if it is not there then create it. Well its not doing what it is suppose to be doing.
And as stated above if more info is needed please let me know..
Thanks in advance,
G3mInI