touch and fopen command

This is a discussion on touch and fopen command within the PHP Language forums, part of the PHP Programming Forums category; Hi, I am kind of new to PHP and while learning I came across the touch command which creates a ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-27-2007
nihad.nasim@gmail.com
 
Posts: n/a
Default touch and fopen command

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

Reply With Quote
  #2 (permalink)  
Old 05-27-2007
Rami Elomaa
 
Posts: n/a
Default Re: touch and fopen command

nihad.nasim@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.

--
Rami.Elomaa@gmail.com

"Wikipedia on vähän niinq internetin raamattu, kukaan ei pohjimmiltaan
usko siihen ja kukaan ei tiedä mikä pitää paikkansa." -- z00ze
Reply With Quote
  #3 (permalink)  
Old 05-28-2007
nihad.nasim@gmail.com
 
Posts: n/a
Default Re: touch and fopen command


> 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?

Reply With Quote
  #4 (permalink)  
Old 05-28-2007
Jerry Stuckle
 
Posts: n/a
Default Re: touch and fopen command

nihad.nasim@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.
jstucklex@attglobal.net
==================
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 05:35 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0