By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,471 Members | 711 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,471 IT Pros & Developers. It's quick & easy.

touch and fopen command

P: n/a
Hi,
I am kind of new to PHP and while learning I came across the touch
command which creates a new file. I also came up with fopen to open a
file. In both cases I am having the same problem:

Source Code:

<?
$fp=fopen("secondfile.txt", 'w');
fclose($fp);
?>

Result:

Warning: fopen(secondfile.txt) [function.fopen]: failed to open
stream: Permission denied in c:\Inetpub\wwwroot\test.php on line 2
Warning: fclose(): supplied argument is not a valid stream resource in
c:\Inetpub\wwwroot\test.php on line 3

I am running windows xp professional sp2 with localhost. I don't have
any problems reading a file. Its writing where I am having problems.
Any help is appreciated. Thanks

May 27 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
ni*********@gmail.com kirjoitti:
Hi,
I am kind of new to PHP and while learning I came across the touch
command which creates a new file. I also came up with fopen to open a
file. In both cases I am having the same problem:
....
stream: Permission denied in c:\Inetpub\wwwroot\test.php on line 2
You've not granted write permission for the webserver user to the
directory where you are trying to create a file. It's usually helpful to
read the error messages.

--
Ra*********@gmail.com

"Wikipedia on vähän niinq internetin raamattu, kukaan ei pohjimmiltaan
usko siihen ja kukaan ei tiedä mikä pitää paikkansa." -- z00ze
May 27 '07 #2

P: n/a
You've not granted write permission for the webserver user to the
directory where you are trying to create a file. It's usually helpful to
read the error messages.

--
Yes I know that but how do I fix that problem in localhost? In other
words, how do I grant write permission for the webserver user to the
directory where I am trying to create the file?

May 28 '07 #3

P: n/a
ni*********@gmail.com wrote:
>You've not granted write permission for the webserver user to the
directory where you are trying to create a file. It's usually helpful to
read the error messages.

--

Yes I know that but how do I fix that problem in localhost? In other
words, how do I grant write permission for the webserver user to the
directory where I am trying to create the file?
This is an OS administration task. You might check the documentation
for Windows XP and/or microsoft.com. Learn about the security features
for XP.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
May 28 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.