Re: fwrite: Want to write PHP generated output to file

From: Date: Thu, 09 Nov 2000 05:20:36 +0000
Subject: Re: fwrite: Want to write PHP generated output to file
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-24424@lists.php.net to get a copy of this message
Martin Cameron writes: > I am in the process of producing a dynamically generated web page. I > want the results to be sent to a file. It doesn't do it. > > Here's the code: [snip] > ***** This is where I am trying to write to a file ****** > The file is touched but no output written to it > Any ideas would be appreciated. > > function make_page(){ > $web_page=make_page2(); > print "hello world"; > touch("public_html/home.html"); > $file="public_html/home.html"; > $fp = fopen($file,"w+"); > fwrite($fp, make_page2()); > fclose($fp); > } [snip2] What are the perms on the directory and the file itself (after touching)? I'm just wondering if maybe something is getting screwed up and the server has write access to the directory but not to the file it's just created. Check umask. ------------------------------------------ Script started on Wed Nov 8 21:16:34 2000 ~/work/php4 shanna% umask 022 ~/work/php4 shanna% umask 777 ~/work/php4 shanna% umask 777 ~/work/php4 shanna% touch bob ~/work/php4 shanna% ls -l bob ---------- 1 torben torben 0 Nov 8 21:16 bob ~/work/php4 shanna% echo "Hi there" > bob bash: bob: Permission denied ~/work/php4 shanna% exit Script done on Wed Nov 8 21:17:12 2000 ----------------------------------------- -- +----------------------------------------------------------------+ |Torben Wilson <torben@php.net> Netmill iTech| |http://www.coastnet.com/~torben http://www.netmill.fi| |Ph: 1 250 383-9735 torben@netmill.fi| +----------------------------------------------------------------+

« previous php.general (#24424) next »