FORUMS: list search recent posts

Simple PHP problem

COW Forums : Web Design

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Paxson WoelberSimple PHP problem
by on Mar 26, 2010 at 8:03:00 am

Hi Creative Cow. A client asked me to build a simple text counter for a site that I built recently. I looked up information about creating counters in PHP but there's a problem somewhere: the page correctly displays the number specified in the counter.txt file that the PHP refers to, but it apparently can't update that file with the new count. The message that shows up on the site, right after the number, is:

Warning: fopen(counter.txt) [function.fopen]: failed to open stream: Permission denied in E:\inetpub\vhosts\\httpdocs\Index.php on line 115
Can't open counter.txt

The full page can be found at . I've never really worked with PHP before, but this looks like it should be a simple problem, I just can't figure out from the code where things are going wrong. It looks like a permissions/access issue but I'm not sure...

Any help/ideas would be awesomely appreciated. Thanks,

Return to posts index

Curtis ThompsonRe: Simple PHP problem
by on Mar 26, 2010 at 2:38:27 pm


not a code problem, actually. webservers all run under a specific user (not the user visiting, but a single user account on the server) that, by default, has very limited rights on the box for security purposes...

so your uploaded .txt file cannot be written to by the php code, which runs under that user. to fix this, you need to change the permissions of the file on the server to allow write access to the webserver user account.

w/o knowing anything about your hosting account, i'd have to refer you to your isp, who probably has docs on changing file permissions on their site. you can do this with most ftp software or via command line on a shell, but your isp might also have a gui file manager in your control panel area that can do it as well...

hope that helps!


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2016 All Rights Reserved