I'm creating a test site so that you enter a name and a message, and once you submit the form it appends what you added to a file, the main page reads from the file and writes it to the page. For some reason the reading works fine, but the script that is supposed to write to the file won't open it (both scripts and the file are in the same directory). If you want to try it on my server the address is: http://ajt-mine1.no-ip.org.
Yeah, I looked in the apache log and it turned out to be a permissions issue, now I'm wondering how I solve it. In my configuration file I have the server admin set as my user @localhost, and the owners of the files should also be owned by my user. Tell me if you want me to post the config file
Ah, shit. I haven't touched PHP or web development since I was 14, and I certainly didn't look at your code. I only called it, because I vividly remembered fighting that same shit in my youth.
ajtgarber wrote:Yeah, I looked in the apache log and it turned out to be a permissions issue, now I'm wondering how I solve it. In my configuration file I have the server admin set as my user @localhost, and the owners of the files should also be owned by my user. Tell me if you want me to post the config file
try setting chmod to 775 if it isn't already, that should give you the right amount of permissions.
ajtgarber wrote:Chmodding the chat.txt? If so, its still telling me that it can't open the file (for writing)
Throw everything you can at it. Try chmod to 777, try the mode "a+" after that. Sometimes you just need to figure out whats going wrong via brute force.
Just using "a" is fine here because this is in a piece of code meant for writing only. "a+" is only needed if you plan to both read and write from the same file handle while it's open.
I have gotten it to work with the chmod 777, but I'm wondering how I would solve this long-term so I wouldn't have to continually do this to files that would need to be edited by my PHP scripts.
I think apache is running as root because I took an upload script of the net and tested it with a simple text file, and the file was write protected. I could be completely wrong on this, I'm (sadly)
still not entirely used to UNIX permissions :P
What's strange is the fact that the script is being run under the "others" category, that is why using 777 worked, as 777 means give permission to all, and 775 means give "others" permission to read and execute. Try 776 or 772.
So for some reason it looks like the server believes itself to be someone else. As i believe most of you know, PHP is a server sided scripting language, therefore the server runs the script and not the user. Basically, this is weird, or i could be reading the chmod wrong myself.