Re: A new comer's 1st question

From: Date: Tue, 05 Sep 2000 03:25:16 +0000
Subject: Re: A new comer's 1st question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-15221@lists.php.net to get a copy of this message
David Robley wrote: > > On 4 Sep, Rick Yin wrote: > > Hi all, I have trouble to write a new file on a remote > > server through web interface. > > > > On my NT network, I test the following code on > > both IIS4 and Apache 1.3.12. The file "mydata.txt" > > is created successfully on both web servers. > > > > <?php > > $newfile = fopen("mydata.txt", "a+"); > > fwrite($newfile, "This is a new file."); > > fclose($newfile); > > echo "All is done!"; > > ?> > > > > When I uploaded this file to my remote web site, the > > following error is generated. > > > > ==start== > > Warning: fopen("mydata.txt","a+") - Permission denied in > > /free/home/greenfield/phtest/writeagain.php on line 38 > > > > Warning: Unable to find file identifier 0 in > > /free/home/greenfield/phtest/writeagain.php on line 39 > > > > Warning: Unable to find file identifier 0 in > > /free/home/greenfield/phtest/writeagain.php on line 40 > > All is done! > > ==end== > > > > It seems to be a permission problem. From running > > phpinfo(), I know the remote server runs php3.0.12, Apache > > and some flavor of LINUX. What could be wrong? > > Please help me out. Thanks. > > You are probably right; the user that the web server runs as, usually > nobody, does not have permission to create files in the target > directory. You'll need to add the relevant permissions, if that is > permissible by your ISP > I'm not sure if I can add permission to the directory. Normally I upload my web contents to the place through ftp (with userid and password). I want to create a site where surfer can upload files to my site through web interface. If you care, you can run http://greenfield.heha.net/phtest/helloworld.php to see some php envir about the site. If it's not possible for surfers to up files on this site, I may have to find another host.

« previous php.general (#15221) next »