Re: HEEEELP! CAN'T WRITE ON A FILE
| From: | phplam | Date: | Sun, 02 Feb 2003 17:39:02 +0000 |
| Subject: | Re: HEEEELP! CAN'T WRITE ON A FILE | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-18300@lists.php.net to get a copy of this message | ||
Hi Dash,
I did it !!!!!
I did it !!!!!
I follow your instructions and I did it.
I reinstalled 4.2.3 instead of RC2.
Now, all is right
Thanks a lot. Thanks to you also chris fo
phplam
"Phplam" <phplam@lamejorsolucion.com> escribió en el mensaje
news:20030128194451.25091.qmail@pb1.pair.com...
> Hello !
> I'm in a mess. Please help me.
> Every time I tried to write with fwrite or fputs in a file, I get an error
> on windows nt sp6 , ie6 from "Doc. Watson" saying that Apache.exe makes an
> application access error .
> Filesystem functions: is_readable, is_writable,fopen,fclose are ok . I can
> create, find and open the file.
> versions: PHP 4.2.3, APACHE 1.3
> httpd.conf :
> Alias /test/ "C:/Apache/htdocs/test/"
>
> <Directory "C:/Apache/htdocs/test">
> Options Indexes MultiViews
> AllowOverride None
> Order allow,deny
> Allow from all
> </Directory>
> ----------
> example1:
> // start buffering the output
> ob_start();
> $filename = "c:\\apache\\htdocs\\test\files\\mifile.txt";
> // output format - either "www" or "file"
> $output = "file";
> // print some output
> print "Welcome to the Matrix, Neo";
> // now decide what to do with the buffered output
> if ($output == "www")
> {
> // either print the contents of the buffer...
> ob_end_flush();
> }
> else
> {
> // ... or write it to a file
> $data = ob_get_contents();
> chmod ($filename, 0777);
> $fp = fopen ($filename, "wb+");
> //ERROR IS HERE
> fwrite($fp, $data);
> fclose($fp);
> ob_end_clean();
> }
>
> example 2:
> //I've tried each of the following 5 $filename assignments.
> //$filename = "c:\\apache\\htdocs\\mcm\\mifile.txt";
> //$filename = "/mifile.txt";
> //$filename = "mifile.txt";
> //$filename = "c:\\tmp\\mifile.txt";
> $filename = "c:\\apache\\htdocs\\test\files\\mifile.txt";
> $somecontent = "Add this to the file\n";
> $fp = fopen($filename,"wb");
> // Write $somecontent to our opened file.
> //ERROR IS HERE
> if (!fwrite($fp, $somecontent)) {
> print "Cannot write to file ($filename)";
> exit;
> }
> fclose($fp);
>
>
>
>
>