Results 1 to 6 of 6
So i have Apache2.0 running on my muchine and i'm using it as test ground for my PHP scripts.
Here is the script that gives me problem:
Code:
<?php
$tireqty=$_POST['tireqty'];
...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 05-27-2005 #1
Problems with PHP script, maybe related to apache settings.
So i have Apache2.0 running on my muchine and i'm using it as test ground for my PHP scripts.
Here is the script that gives me problem:
It gives me the following error:Code:<?php $tireqty=$_POST['tireqty']; $oilqty=$_POST['oilqty']; $sparkqty=$_POST['sparkqty']; if (($tireqty == "") or ($oilqty == "") or ($sparkqty == "")) { header("Location: http://localhost/orderform.html"); exit; } ?> <html> <head> <title>Bob's Auto Parts - Order Results</title> </head> <body> <h1>Auto Parts</h1> <h2>Order Results</h2> <?php echo " Order Results:</p>"; echo date("H:i, jS F Y"); echo " "; echo " Your order is as follows:</p>"; echo " "; echo "$tireqty tires "; echo "$oilqty bottles of oil "; echo "$sparkqty spark plugs "; $fp = fopen("$DOCUMENT_ROOT/vitali/filesystem/orders.txt", "W"); if (!$fp) { echo " Your order could not be processed at this time. " ."Please try again later.</p>"; exit; } else { $outputspring = $date. "\t".$tireqty." tires \t".$oilqty.' oit\t' .$sparkqty." spark plugs\t\$".$total ."\t". $address. "\n"; fwrite($fp, $outputstring); fclose($fp); } ?> </body> </html>
I'v been looking at the code for the past 3 days. Checked many websites and it seems that my script is correct. So te problem might be in Apache or PHP module.Warning: fopen(/home/estonia/public_html/vitali/filesystem/orders.txt): failed to open stream: Success in /home/estonia/public_html/vitali/processorder.php on line 27
If any of you guys have any idea, that would be great.
By the way i'm using Fedora Core3 to run Apache2.0.
Thank you for your time.
- 05-27-2005 #2Linux Newbie
- Join Date
- Jan 2004
- Location
- Belgrade, S&M
- Posts
- 177
Could it be a permissions problem ?
- 05-27-2005 #3
Permissions are set to 777, but still it wouldn't work. IF it would not allow to create files in a folder then it would tell me that i don't have permission to do that.
- 05-27-2005 #4Just Joined!
- Join Date
- Jan 2005
- Location
- UK
- Posts
- 77
check your apache logs to see if the script is throwing up any errors, it usually tells you any problems straight up.
- 05-27-2005 #5
These are last three lines that were added after scipt was executed:
i hope that can point into the right direction.Code:[Fri May 27 19:34:16 2005] [error] [client 127.0.0.1] File does not exist: /var/www/html/favicon.ico [client 127.0.0.1] PHP Warning: fopen(./filesystem/orders.txt): failed to open stream: Success in /var/www/html/processorder.php on line 27, referer: http://localhost/orderform.html [Fri May 27 19:34:17 2005] [error] [client 127.0.0.1] File does not exist: /var/www/html/favicon.ico
- 05-28-2005 #6Linux Engineer
- Join Date
- Nov 2004
- Location
- Ft. Polk, LA
- Posts
- 796
Use $_SERVER['DOCUMENT_ROOT'] instead of $DOCUMENT_ROOT . The use of $DOCUMENT_ROOT is deprecated and relies on php being less secure by having register globals on, which you should never ever do.


Reply With Quote
