Stoneyhill
February 2nd, 2009, 11:56 PM
Hi
Im using php (on lamp) on localhost to try and teach myself php with the help of a book, on Intrepid Ibex and so far all has been working well...
HOWEVER..
when i am trying to read and write to files with php im having some problems
$fp = fopen("http://localhost/orders.txt", 'r');
works fine and i can read the file without ANY problems, however if i want to use:
$fp = fopen(“$DOCUMENT_ROOT/../orders/orders.txt”, ‘w’);
or even an absolute path such as /var/www/orders.txt
i get the following error:
Warning: fopen(/var/www/orders.txt) [function.fopen]: failed to open stream: Permission denied in /var/www/processorder.php on line 72
can anyone tell help me understand what is going on here...? if its something to do with apache permissions then can anyone tell me how to change them etc...
NOTE without the use of
sudo in the command line i cannot edit ANYTHING in the /var/www directory at all so thought perhaps that was the issue, however when i used an absolute path to a file outside /var/www i get a similar error....
thanks
Im using php (on lamp) on localhost to try and teach myself php with the help of a book, on Intrepid Ibex and so far all has been working well...
HOWEVER..
when i am trying to read and write to files with php im having some problems
$fp = fopen("http://localhost/orders.txt", 'r');
works fine and i can read the file without ANY problems, however if i want to use:
$fp = fopen(“$DOCUMENT_ROOT/../orders/orders.txt”, ‘w’);
or even an absolute path such as /var/www/orders.txt
i get the following error:
Warning: fopen(/var/www/orders.txt) [function.fopen]: failed to open stream: Permission denied in /var/www/processorder.php on line 72
can anyone tell help me understand what is going on here...? if its something to do with apache permissions then can anyone tell me how to change them etc...
NOTE without the use of
sudo in the command line i cannot edit ANYTHING in the /var/www directory at all so thought perhaps that was the issue, however when i used an absolute path to a file outside /var/www i get a similar error....
thanks