Writing to a text file on the server?

I’m trying to set up a RSVP form which will take form data and write it to a simple text file on the dreamhost server. I am submitting this form to a PHP script. Right now a simple test code looks like:

$myFile = fopen(‘rsvp_data.txt’,‘w’);
fwrite($myFile,‘This is a test\n’);
fclose($myFile);

rsvp_data.txt already exists on the server, but I can not get the form to write to the file. I’ve tried changing the permissions on it to all sorts of combinations, and it won’t write. However, if I log in to the server through SSH, and run the script though the command line “php -f”, the file gets written to. Anyone know what I’m doing wrong?

I’m new to PHP, but have used CGI, perl, and a variety of other languages before. I’m using the DreamHost shared solution, if that matters.

if the file already exists, change ‘w’ (write) to ‘a’ (append).

Thanks bobocat. I just realized my mistake… I was trying to debug the code, and I had commented out the call to the php processor… Everything is working now–and thanks for the append tip as well. :slight_smile:

Well, I don’t know so much about the technical things and that’s why I can’t give you any suggestion about this. But, If you are looking for any writing related help then you can visit here where you can take help for your writing work and here you can easily choose a writing service for your work by reading their reviews.

HI, i am Mason French,
i have a site with the name of gotogears, i want please send me packages of your dtreamhost.

thanks.