Re: A new comer's 1st question

From: Date: Tue, 05 Sep 2000 02:38:47 +0000
Subject: Re: A new comer's 1st question
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-15209@lists.php.net to get a copy of this message
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 -- David Robley | WEBMASTER & Mail List Admin RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ AusEinet | http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA

« previous php.general (#15209) next »