Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Permission Question: Accessing a text file 1

Status
Not open for further replies.

natwod

Programmer
Nov 21, 2002
41
US
I am making a hit counter using a text file; I use PHP to retrieve the number in the file, increment it, and re-write it to the text file.

It worked fine on my machine using Microsoft IIS, but on my friend's server, I get the following message:

Warning: fopen("counter.txt", "wb") - Permission denied in /Library/WebServer/ on line 234

My friend doesn't know anything about PHP, and I don't know much about Web Servers. Is this a PHP coding issue or a server permission issue? Any ideas on fixing this?

Thank you!!!!
Natwad
 
Natwood,

It could be a server permission issue or if PHP runs in safe mode a safe mode issue. However, if safe mode, I think safe mode would be mentioned.
Since I don't know what server it is, can't give you any specifics besides that the user as whcih the server runs needs read/write permissions in the are the file resides.
 
Hi!

Well, if this changes anything, my friend is using a Mac server.

Natwad
 
I assume you have OS X.
There you need to inspect as what user the apache server runs and make sure that the permissions for the file are set correctly.
I suggest that you use a shell window and cd into the folder. Make sure that the read/write access for the file is set correctly.
The most secure level is to have the file owned by the user the webserver runs under. It is not advisable to give read/write access to the world in general.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top