Web Hosting Talk







View Full Version : PHP fopen() problem here.


trackstr777
03-23-2004, 12:04 PM
Hey guys, I'm writing a news script that involves writing a file that doesn't exist yet, and also appending to a file that does exist. I have set 'w' mode for each fwrite() function, and I'm still having troubles writing to the files.

For the existing file, I had to CHMOD the folder and files with more permissions, and it worked, but for some reason it still won't create the other file.

Can someone please explain what settings or anything else I need to change so that PHP will also create the new file, along with appending to the existing one?

Caym
03-24-2004, 08:51 PM
Probably you don't have the permission to write in that folder (ex. htaccess or public_html) or the folder has a different owner than the php file (under *nix).

Loon
03-24-2004, 09:43 PM
The error message(s) you're getting (if any) would be useful. Though you realise that the w condition will open and point to the beginning of the file? so in the file you want to ammend you might want to use 'a' instead which would open and point to the end of the file, for writing after any existing content.