Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I am trying to write to a directory using PHP5.
The commands I am using are :
$fp = fopen("$DOCUMENT_ROOT/../orders/orders.txt", "ab");
$fp = fopen("$DOCUMENT_ROOT/../orders/orders.txt", "w");
$fp = fopen("orders.txt", "w");The top one of the 3 is straight out of the book. The scripts I am using are out of the “PHP and MySQL Web Development” book by Welling Thomson, so the code is all good.
The message I got is as follows:
Warning: fopen(/var/www/html/../orders/orders.txt) [function.fopen]: failed to open stream: Permission denied in /var/www/html/processorder.php on line 129
I tried to write to other directories and that failed too, the directories concerned had read and write permissions enabled for everyone.
I checked the value of $DOCUMENT_ROOT and it is as I expected i.e.:
/var/www/html/../orders/orders.txt/var/www/orders is a writeable directory for everyone
Do you know why I cannot write to this directory, I guess I have a config problem somewhere, but I have no idea.

Thanks, but this does not help. The files and the directories are all read and writeable.
Any other suggestions?
Orders.txt is 666, I changed it to 777, but it didn't help as expected.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |