Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 21st, 2006, 12:38 AM
Registered User
 
Join Date: Dec 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default fopen permission denied

I am adding a hit counter to a site.
I can read to the count.txt file but cannot write to the file to increment the total.
I get a message.

Warning: fopen(./count.txt): failed to open stream: Permission denied in c:\inetpub\wwwroot\pam\index_working.php on line 90

Warning: fwrite(): supplied argument is not a valid stream resource in c:\inetpub\wwwroot\pam\index_working.php on line 91

Warning: fclose(): supplied argument is not a valid stream resource in c:\inetpub\wwwroot\pam\index_working.php on line 92
Your are visitor:31


I am using windows xp pro IIC

I have checked the internet and have so far found others with this problem but so far no fix.

Any ideas??


The code is below

<?php
$a = fopen ("./count.txt", "r");
$bytes = 4;
$x = fread($a, $bytes);
$y=$x + 1;
$fp = fopen ("./count.txt", "w");
fwrite ($fp, "$y");
fclose ($fp);
echo "Your are visitor:$y";
?>


 
Old February 24th, 2006, 03:56 PM
Registered User
 
Join Date: Feb 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to digioz
Default

You need to give the Web Server User (the username under which your web server runs) write permission to the text file that contains your counter value.



DigiOz Multimedia
http://www.digioz.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
(0x800A0046) Permission denied,not IIS permission! David Hay Classic ASP Basics 3 April 30th, 2006 10:47 PM
Permission denied zah_amir Classic ASP Databases 1 January 24th, 2006 11:45 PM
Permission denied tksarun Classic ASP Components 0 March 11th, 2005 03:01 AM
Permission Denied hamidmq Javascript How-To 2 March 10th, 2005 09:41 AM
Permission Denied einstein Linux 1 December 10th, 2003 09:49 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.