[PHP] fwrite not writing

2001-04-15 Thread CC Zona

This function suddenly stopped working, and I just can't seem to figure out 
why.  The only change made recently is that now the value of $force at 
calltime is sometimes true instead of being undefined or null.  

build_file("file_content","/path/to/file.inc","w",TRUE);

function build_file($func_name,$filepath,$mode="w",$force=FALSE)
   {
   if($force or !file_exists($filepath) or !filesize($filepath)) //echo 
filesize($filepath) shows '0'
  { 
  $content=$func_name(); //echo $content shows it's all there
   $fp=fopen($filepath,$mode); 
   fwrite($fp,$content);
   rewind($fp); #temp test
  $read_back=fread($fp,10); #temp test
  echo "file content:\n $read_back"; #temp test, displays nothing
 fclose($fp); 
  }
   }

I've tried putting echoes and "or die('Error on __LINE__')" on every line, 
checked all the variable values, and found no answers from that.  
Everything shows exactly as it should be except that the content that 
echoes out so nicely *doesn't ever get written to the file*.  The function 
runs to the end without error and the file's modification date is even 
updated.  But the file remains empty. I'm probably missing something 
ridiculously obvious, but would someone please be kind enough to point out 
what it is?  Thank you!!

-- 
CC

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] fwrite not writing

2001-04-15 Thread Plutarck

What is this:

!filesize($filepath)

Add this above your if loop:

$filesize = filesize($filepath);
echo $filesize;


That might be causing your loop not to execute...if not, I'm not sure what's
wrong.


--
Plutarck
Should be working on something...
...but forgot what it was.


"CC Zona" <[EMAIL PROTECTED]> wrote in message
9bdv8u$2la$[EMAIL PROTECTED]">news:9bdv8u$2la$[EMAIL PROTECTED]...
> This function suddenly stopped working, and I just can't seem to figure
out
> why.  The only change made recently is that now the value of $force at
> calltime is sometimes true instead of being undefined or null.
>
> build_file("file_content","/path/to/file.inc","w",TRUE);
>
> function build_file($func_name,$filepath,$mode="w",$force=FALSE)
>{
>if($force or !file_exists($filepath) or !filesize($filepath)) //echo
> filesize($filepath) shows '0'
>   {
>   $content=$func_name(); //echo $content shows it's all there
>$fp=fopen($filepath,$mode);
>fwrite($fp,$content);
>rewind($fp); #temp test
>   $read_back=fread($fp,10); #temp test
>   echo "file content:\n $read_back"; #temp test, displays
nothing
>  fclose($fp);
>   }
>}
>
> I've tried putting echoes and "or die('Error on __LINE__')" on every line,
> checked all the variable values, and found no answers from that.
> Everything shows exactly as it should be except that the content that
> echoes out so nicely *doesn't ever get written to the file*.  The function
> runs to the end without error and the file's modification date is even
> updated.  But the file remains empty. I'm probably missing something
> ridiculously obvious, but would someone please be kind enough to point out
> what it is?  Thank you!!
>
> --
> CC
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] fwrite not writing

2001-04-16 Thread CC Zona

> > This function suddenly stopped working, and I just can't seem to figure
> out
> > why.  The only change made recently is that now the value of $force at
> > calltime is sometimes true instead of being undefined or null.
> >
> > build_file("file_content","/path/to/file.inc","w",TRUE);
> >
> > function build_file($func_name,$filepath,$mode="w",$force=FALSE)
> >{
> >if($force or !file_exists($filepath) or !filesize($filepath)) //echo
> > filesize($filepath) shows '0'
> >   {
> >   $content=$func_name(); //echo $content shows it's all there
> >$fp=fopen($filepath,$mode);
> >fwrite($fp,$content);
> >rewind($fp); #temp test
> >   $read_back=fread($fp,10); #temp test
> >   echo "file content:\n $read_back"; #temp test, displays
> nothing
> >  fclose($fp);
> >   }
> >}
> >
> > I've tried putting echoes and "or die('Error on __LINE__')" on every line,
> > checked all the variable values, and found no answers from that.
> > Everything shows exactly as it should be except that the content that
> > echoes out so nicely *doesn't ever get written to the file*.  The function
> > runs to the end without error and the file's modification date is even
> > updated.  But the file remains empty. I'm probably missing something
> > ridiculously obvious, but would someone please be kind enough to point out
> > what it is?  Thank you!!

> What is this:
> 
> !filesize($filepath)

If filesize is zero (which it is ), then do the rest (which it 
does--except the content it fetches never makes it into the file it writes 
to.  How that can be, I dunno, but that apparently is what it's doing...)

> Add this above your if loop:
> 
> $filesize = filesize($filepath);
> echo $filesize;

Already tried echoing that and all the other values.  Filesize is 0.

> That might be causing your loop not to execute...if not, I'm not sure what's
> wrong.

I don't get it.  It should work.  It did work.  Suddenly it's not.

-- 
CC

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] fwrite not writing

2001-04-16 Thread Plutarck

Ahhh, I see what's going on now. I had more time to read over the code, so
now I see what you are trying to do.

I'm not sure why it suddenly stopped working, but let's see if you actually
need it to work.

First of all, I take it that you have content which you want to write into a
file. Correct?

If so, why does it matter if the file you want to write it to has data
anyway? If you are just going to add data into it, isn't it ok that it is a
zerolength file?

Or is the problem that the file is _not_ actually zerolength, but PHP says
it's zerolength anyway?

Just try removing the !filesize() part, and then try executing the function.

But maybe I just don't understand what you are trying to write and why.
Could you be a little more specific what data is being saved in the file,
and what is in the file already?


--
Plutarck
Should be working on something...
...but forgot what it was.


"CC Zona" <[EMAIL PROTECTED]> wrote in message
9bebi3$133$[EMAIL PROTECTED]">news:9bebi3$133$[EMAIL PROTECTED]...
> > > This function suddenly stopped working, and I just can't seem to
figure
> > out
> > > why.  The only change made recently is that now the value of $force at
> > > calltime is sometimes true instead of being undefined or null.
> > >
> > > build_file("file_content","/path/to/file.inc","w",TRUE);
> > >
> > > function build_file($func_name,$filepath,$mode="w",$force=FALSE)
> > >{
> > >if($force or !file_exists($filepath) or !filesize($filepath))
//echo
> > > filesize($filepath) shows '0'
> > >   {
> > >   $content=$func_name(); //echo $content shows it's all there
> > >$fp=fopen($filepath,$mode);
> > >fwrite($fp,$content);
> > >rewind($fp); #temp test
> > >   $read_back=fread($fp,10); #temp test
> > >   echo "file content:\n $read_back"; #temp test, displays
> > nothing
> > >  fclose($fp);
> > >   }
> > >}
> > >
> > > I've tried putting echoes and "or die('Error on __LINE__')" on every
line,
> > > checked all the variable values, and found no answers from that.
> > > Everything shows exactly as it should be except that the content that
> > > echoes out so nicely *doesn't ever get written to the file*.  The
function
> > > runs to the end without error and the file's modification date is even
> > > updated.  But the file remains empty. I'm probably missing something
> > > ridiculously obvious, but would someone please be kind enough to point
out
> > > what it is?  Thank you!!
>
> > What is this:
> >
> > !filesize($filepath)
>
> If filesize is zero (which it is ), then do the rest (which it
> does--except the content it fetches never makes it into the file it writes
> to.  How that can be, I dunno, but that apparently is what it's doing...)
>
> > Add this above your if loop:
> >
> > $filesize = filesize($filepath);
> > echo $filesize;
>
> Already tried echoing that and all the other values.  Filesize is 0.
>
> > That might be causing your loop not to execute...if not, I'm not sure
what's
> > wrong.
>
> I don't get it.  It should work.  It did work.  Suddenly it's not.
>
> --
> CC
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] fwrite not writing

2001-04-16 Thread CC Zona

In article <9bejks$gl6$[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] ("Plutarck") wrote:

> I'm not sure why it suddenly stopped working, but let's see if you actually
> need it to work.
> 
> First of all, I take it that you have content which you want to write into a
> file. Correct?
> 
> If so, why does it matter if the file you want to write it to has data
> anyway? If you are just going to add data into it, isn't it ok that it is a
> zerolength file?

It is needed.  I have a dynamically generated page.  Most of the content 
needs to be re-generated with every request.  But some of it needs to be 
re-generated far less often.  Rather than unnecessarily hit the db every 
time to get the exact same content, that content gets cached to an include 
file.  This function checks whether that file needs to get a content 
refresh, and if so rewrites that content.  (I'm not adding data to the 
file, I'm overwriting it.)

> Or is the problem that the file is _not_ actually zerolength, but PHP says
> it's zerolength anyway?

Nope, it's really zero length.  The filesystem agrees with PHP, and when I 
open it in a text editor the file is empty.

> Just try removing the !filesize() part, and then try executing the function.

I commented out the entire if() condition, it makes no difference.  Maybe I 
have not made this clear enough: the problem is not in getting inside the 
loop.  The function *is* executing the loop, and *is* reaching the fwite() 
line as well as continuing without error past that line.  The frustrating 
part is that fwrite() is writing an empty string to the file instead of 
using the $content variable (which, when echoed immediately before that 
line, is definitely not empty/null).

> But maybe I just don't understand what you are trying to write and why.
> Could you be a little more specific what data is being saved in the file,
> and what is in the file already?

Sometimes the file has data, sometimes it doesn't; sometimes the file 
exists, sometimes it does.  Right now, unfortunately, the file remains 
empty. I'm trying to fill it with a large block of dynamically generated 
HTML which will then be used as a static include file for current and 
subsequent requests.



> "CC Zona" <[EMAIL PROTECTED]> wrote in message
> 9bebi3$133$[EMAIL PROTECTED]">news:9bebi3$133$[EMAIL PROTECTED]...
> > > > This function suddenly stopped working, and I just can't seem to
> figure
> > > out
> > > > why.  The only change made recently is that now the value of $force at
> > > > calltime is sometimes true instead of being undefined or null.
> > > >
> > > > build_file("file_content","/path/to/file.inc","w",TRUE);
> > > >
> > > > function build_file($func_name,$filepath,$mode="w",$force=FALSE)
> > > >{
> > > >if($force or !file_exists($filepath) or !filesize($filepath))
> //echo
> > > > filesize($filepath) shows '0'
> > > >   {
> > > >   $content=$func_name(); //echo $content shows it's all there
> > > >$fp=fopen($filepath,$mode);
> > > >fwrite($fp,$content);
> > > >rewind($fp); #temp test
> > > >   $read_back=fread($fp,10); #temp test
> > > >   echo "file content:\n $read_back"; #temp test, displays
> > > nothing
> > > >  fclose($fp);
> > > >   }
> > > >}
> > > >
> > > > I've tried putting echoes and "or die('Error on __LINE__')" on every
> line,
> > > > checked all the variable values, and found no answers from that.
> > > > Everything shows exactly as it should be except that the content that
> > > > echoes out so nicely *doesn't ever get written to the file*.  The
> function
> > > > runs to the end without error and the file's modification date is even
> > > > updated.  But the file remains empty. I'm probably missing something
> > > > ridiculously obvious, but would someone please be kind enough to point
> out
> > > > what it is?  Thank you!!
> >
> > > What is this:
> > >
> > > !filesize($filepath)
> >
> > If filesize is zero (which it is ), then do the rest (which it
> > does--except the content it fetches never makes it into the file it writes
> > to.  How that can be, I dunno, but that apparently is what it's doing...)
> >
> > > Add this above your if loop:
> > >
> > > $filesize = filesize($filepath);
> > > echo $filesize;
> >
> > Already tried echoing that and all the other values.  Filesize is 0.
> >
> > > That might be causing your loop not to execute...if not, I'm not sure
> what's
> > > wrong.
> >
> > I don't get it.  It should work.  It did work.  Suddenly it's not.

-- 
CC

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] fwrite not writing

2001-04-16 Thread Szii

> if($force or !file_exists($filepath) or !filesize($filepath))

May I suggest

if ($force || (!file_exists($filepath)) || (!filesize($filepath)))

Probably won't make much difference, but I've never used the "or"
clause and cannot vouch for it's effectiveness.

Also, put a check in after the fopen() call and make sure you're
able to open up the file correctly.

Perhaps and fflush() call before the rewind() call to ensure that
the file buffer's actually written to disk before you try to re-read it?

'Luck

-Szii


- Original Message -
From: CC Zona <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 16, 2001 12:06 PM
Subject: Re: [PHP] fwrite not writing


> In article <9bejks$gl6$[EMAIL PROTECTED]>,
>  [EMAIL PROTECTED] ("Plutarck") wrote:
>
> > I'm not sure why it suddenly stopped working, but let's see if you
actually
> > need it to work.
> >
> > First of all, I take it that you have content which you want to write
into a
> > file. Correct?
> >
> > If so, why does it matter if the file you want to write it to has data
> > anyway? If you are just going to add data into it, isn't it ok that it
is a
> > zerolength file?
>
> It is needed.  I have a dynamically generated page.  Most of the content
> needs to be re-generated with every request.  But some of it needs to be
> re-generated far less often.  Rather than unnecessarily hit the db every
> time to get the exact same content, that content gets cached to an include
> file.  This function checks whether that file needs to get a content
> refresh, and if so rewrites that content.  (I'm not adding data to the
> file, I'm overwriting it.)
>
> > Or is the problem that the file is _not_ actually zerolength, but PHP
says
> > it's zerolength anyway?
>
> Nope, it's really zero length.  The filesystem agrees with PHP, and when I
> open it in a text editor the file is empty.
>
> > Just try removing the !filesize() part, and then try executing the
function.
>
> I commented out the entire if() condition, it makes no difference.  Maybe
I
> have not made this clear enough: the problem is not in getting inside the
> loop.  The function *is* executing the loop, and *is* reaching the fwite()
> line as well as continuing without error past that line.  The frustrating
> part is that fwrite() is writing an empty string to the file instead of
> using the $content variable (which, when echoed immediately before that
> line, is definitely not empty/null).
>
> > But maybe I just don't understand what you are trying to write and why.
> > Could you be a little more specific what data is being saved in the
file,
> > and what is in the file already?
>
> Sometimes the file has data, sometimes it doesn't; sometimes the file
> exists, sometimes it does.  Right now, unfortunately, the file remains
> empty. I'm trying to fill it with a large block of dynamically generated
> HTML which will then be used as a static include file for current and
> subsequent requests.
>
>
>
> > "CC Zona" <[EMAIL PROTECTED]> wrote in message
> > 9bebi3$133$[EMAIL PROTECTED]">news:9bebi3$133$[EMAIL PROTECTED]...
> > > > > This function suddenly stopped working, and I just can't seem to
> > figure
> > > > out
> > > > > why.  The only change made recently is that now the value of
$force at
> > > > > calltime is sometimes true instead of being undefined or null.
> > > > >
> > > > > build_file("file_content","/path/to/file.inc","w",TRUE);
> > > > >
> > > > > function build_file($func_name,$filepath,$mode="w",$force=FALSE)
> > > > >{
> > > > >if($force or !file_exists($filepath) or !filesize($filepath))
> > file://echo
> > > > > filesize($filepath) shows '0'
> > > > >   {
> > > > >   $content=$func_name(); file://echo $content shows it's all
there
> > > > >$fp=fopen($filepath,$mode);
> > > > >fwrite($fp,$content);
> > > > >rewind($fp); #temp test
> > > > >   $read_back=fread($fp,10); #temp test
> > > > >   echo "file content:\n $read_back"; #temp test,
displays
> > > > nothing
> > > > >  fclose($fp);
> > > > >   }
> > > > >}
> > > > >
> > > > > I've tried putting echoes and "or die('Error on __LINE__')" on
every
> > line,
&g

[PHP] fwrite not writing (simpler example), PHP 4.0.4pl1, Apache/1.3.14

2001-04-16 Thread CC Zona

Suggestions so far have focused on parts of the function other than fwrite, 
so I'm trying again with a stripped-down example.  After spending many 
hours trying to make this very simple function work again, I'm beginning to 
think fwrite in broken--either in 4.0.4pl1 (?!) or in my build of it (it 
was working fine before...).  Before filing a bug report, would a few 
people test whether this fails to write on their system too? Thank you!


function build_file()
   {
   $fp=fopen("/path/to/directory/test.inc","w") or die("ERROR on fopen" . 
$php_errormsg); 
   fwrite($fp,"Hi, I'm some test content",1) or die("ERROR: 
fwrite " . $php_errormsg);
   fclose($fp) or die("ERROR: fclose" . $php_errormsg);
   }

build_file(); //no errors and file modification date is updated

echo "Begin include..."; //ok
include("/path/to/directory/test.inc"); //NOTHING!
echo "...End include"; //ok

(Checking from the commandline, the file is definitely being set to empty.  
It's writing an empty string to the file instead of writing the specified 
content.)

-- 
CC

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] fwrite not writing (simpler example), PHP 4.0.4pl1, Apache/1.3.14

2001-04-16 Thread Chris Anderson

Have you checked the following things:
A) if the file is actually there?
B)Is it an include error
C)Do you have the required permissions for write access and for including
from that directory?
- Original Message -
From: "CC Zona" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 16, 2001 5:34 PM
Subject: [PHP] fwrite not writing (simpler example), PHP 4.0.4pl1,
Apache/1.3.14


> Suggestions so far have focused on parts of the function other than
fwrite,
> so I'm trying again with a stripped-down example.  After spending many
> hours trying to make this very simple function work again, I'm beginning
to
> think fwrite in broken--either in 4.0.4pl1 (?!) or in my build of it (it
> was working fine before...).  Before filing a bug report, would a few
> people test whether this fails to write on their system too? Thank you!
>
>
> function build_file()
>{
>$fp=fopen("/path/to/directory/test.inc","w") or die("ERROR on fopen" .
> $php_errormsg);
>fwrite($fp,"Hi, I'm some test content",1) or die("ERROR:
> fwrite " . $php_errormsg);
>fclose($fp) or die("ERROR: fclose" . $php_errormsg);
>}
>
> build_file(); //no errors and file modification date is updated
>
> echo "Begin include..."; //ok
> include("/path/to/directory/test.inc"); //NOTHING!
> echo "...End include"; //ok
>
> (Checking from the commandline, the file is definitely being set to empty.
> It's writing an empty string to the file instead of writing the specified
> content.)
>
> --
> CC
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] fwrite not writing (simpler example), PHP 4.0.4pl1, Apache/1.3.14

2001-04-16 Thread CC Zona

In article <002b01c0c697$9628ee00$8b1412d1@null>,
 [EMAIL PROTECTED] ("Chris Anderson") wrote:

> Have you checked the following things:
> A) if the file is actually there?

Yes.  (And even when the file is not there,  fopen() correctly re-creates 
it.  And fwrite continued to write the wrong--empty--string to it.)

> B)Is it an include error

Checked, and no.  The file is being included.  It just doesn't have any 
content to display.

> C)Do you have the required permissions for write access and for including
> from that directory?

Permissions: yes (the file is updating, just with the wrong content)
Including: yes (it's in the include path too)

I've also checked that no other fuction is writing to the same file and 
that the function is not recursing (to, say, write the correct content on 
one pass then overwrite with empty string on the next pass).  No to those 
too. 


> - Original Message -
> From: "CC Zona" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, April 16, 2001 5:34 PM
> Subject: [PHP] fwrite not writing (simpler example), PHP 4.0.4pl1,
> Apache/1.3.14
> 
> 
> > Suggestions so far have focused on parts of the function other than
> fwrite,
> > so I'm trying again with a stripped-down example.  After spending many
> > hours trying to make this very simple function work again, I'm beginning
> to
> > think fwrite in broken--either in 4.0.4pl1 (?!) or in my build of it (it
> > was working fine before...).  Before filing a bug report, would a few
> > people test whether this fails to write on their system too? Thank you!
> >
> >
> > function build_file()
> >{
> >$fp=fopen("/path/to/directory/test.inc","w") or die("ERROR on fopen" .
> > $php_errormsg);
> >fwrite($fp,"Hi, I'm some test content",1) or die("ERROR:
> > fwrite " . $php_errormsg);
> >fclose($fp) or die("ERROR: fclose" . $php_errormsg);
> >}
> >
> > build_file(); //no errors and file modification date is updated
> >
> > echo "Begin include..."; //ok
> > include("/path/to/directory/test.inc"); //NOTHING!
> > echo "...End include"; //ok
> >
> > (Checking from the commandline, the file is definitely being set to empty.
> > It's writing an empty string to the file instead of writing the specified
> > content.)

-- 
CC

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] fwrite not writing (simpler example), PHP 4.0.4pl1, Apache/1.3.14

2001-04-16 Thread Chris Anderson

come to think of it, why are you passing 3 arguements to fwrite()?
- Original Message -
From: "CC Zona" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 16, 2001 5:34 PM
Subject: [PHP] fwrite not writing (simpler example), PHP 4.0.4pl1,
Apache/1.3.14


> Suggestions so far have focused on parts of the function other than
fwrite,
> so I'm trying again with a stripped-down example.  After spending many
> hours trying to make this very simple function work again, I'm beginning
to
> think fwrite in broken--either in 4.0.4pl1 (?!) or in my build of it (it
> was working fine before...).  Before filing a bug report, would a few
> people test whether this fails to write on their system too? Thank you!
>
>
> function build_file()
>{
>$fp=fopen("/path/to/directory/test.inc","w") or die("ERROR on fopen" .
> $php_errormsg);
>fwrite($fp,"Hi, I'm some test content",1) or die("ERROR:
> fwrite " . $php_errormsg);
>fclose($fp) or die("ERROR: fclose" . $php_errormsg);
>}
>
> build_file(); //no errors and file modification date is updated
>
> echo "Begin include..."; //ok
> include("/path/to/directory/test.inc"); //NOTHING!
> echo "...End include"; //ok
>
> (Checking from the commandline, the file is definitely being set to empty.
> It's writing an empty string to the file instead of writing the specified
> content.)
>
> --
> CC
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] fwrite not writing (simpler example), PHP 4.0.4pl1, Apache/1.3.14

2001-04-16 Thread Chris Anderson

alright try removing the byte length identifier
- Original Message -
From: "Chris Anderson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Monday, April 16, 2001 1:20 PM
Subject: Re: [PHP] fwrite not writing (simpler example), PHP 4.0.4pl1,
Apache/1.3.14


> come to think of it, why are you passing 3 arguements to fwrite()?
> - Original Message -
> From: "CC Zona" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, April 16, 2001 5:34 PM
> Subject: [PHP] fwrite not writing (simpler example), PHP 4.0.4pl1,
> Apache/1.3.14
>
>
> > Suggestions so far have focused on parts of the function other than
> fwrite,
> > so I'm trying again with a stripped-down example.  After spending many
> > hours trying to make this very simple function work again, I'm beginning
> to
> > think fwrite in broken--either in 4.0.4pl1 (?!) or in my build of it (it
> > was working fine before...).  Before filing a bug report, would a few
> > people test whether this fails to write on their system too? Thank you!
> >
> >
> > function build_file()
> >{
> >$fp=fopen("/path/to/directory/test.inc","w") or die("ERROR on fopen"
.
> > $php_errormsg);
> >fwrite($fp,"Hi, I'm some test content",1) or
die("ERROR:
> > fwrite " . $php_errormsg);
> >fclose($fp) or die("ERROR: fclose" . $php_errormsg);
> >}
> >
> > build_file(); //no errors and file modification date is updated
> >
> > echo "Begin include..."; //ok
> > include("/path/to/directory/test.inc"); //NOTHING!
> > echo "...End include"; //ok
> >
> > (Checking from the commandline, the file is definitely being set to
empty.
> > It's writing an empty string to the file instead of writing the
specified
> > content.)
> >
> > --
> > CC
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] fwrite not writing (simpler example), PHP 4.0.4pl1, Apache/1.3.14

2001-04-16 Thread CC Zona

In article <006701c0c699$ad65cdc0$8b1412d1@null>,
 [EMAIL PROTECTED] ("Chris Anderson") wrote:

> come to think of it, why are you passing 3 arguements to fwrite()?

Whoops!  That's a typo left over from the last round of tests,  adding 
every optional argument just in case something wasn't really optional.  Of 
course the third argument actually belongs to fopen().  Though it shouldn't 
be needed there either.  (And yup, I just double-checked and it doesn't 
work without the typo either. )

-- 
CC

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] fwrite not writing (simpler example), PHP 4.0.4pl1, Apache/1.3.14

2001-04-16 Thread Chris Anderson

I tried it, even with the byte length identifer it worked perfectly for me.
As a last ditch effort try changing the w to w+. If not then it sounds like
a configuration issue for the webserver or php. Dunno what settings though,
sorry couldn't be of more help.
- Original Message -
From: "CC Zona" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, April 16, 2001 10:48 PM
Subject: Re: [PHP] fwrite not writing (simpler example), PHP 4.0.4pl1,
Apache/1.3.14


> In article <006701c0c699$ad65cdc0$8b1412d1@null>,
>  [EMAIL PROTECTED] ("Chris Anderson") wrote:
>
> > come to think of it, why are you passing 3 arguements to fwrite()?
>
> Whoops!  That's a typo left over from the last round of tests,  adding
> every optional argument just in case something wasn't really optional.  Of
> course the third argument actually belongs to fopen().  Though it
shouldn't
> be needed there either.  (And yup, I just double-checked and it doesn't
> work without the typo either. )
>
> --
> CC
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] fwrite not writing (simpler example), PHP 4.0.4pl1, Apache/1.3.14

2001-04-16 Thread CC Zona

In article <012101c0c69b$b01b8d00$8b1412d1@null>,
 [EMAIL PROTECTED] ("Chris Anderson") wrote:

> I tried it, even with the byte length identifer it worked perfectly for me.
> As a last ditch effort try changing the w to w+. If not then it sounds like
> a configuration issue for the webserver or php. Dunno what settings though,
> sorry couldn't be of more help.

Thanks for testing.  Was that with v4.0.4pl?  I'd sure like to know whether 
there's any possbility it's bug.  Seems unlikely, but then again so does 
the stubborness of frwite() in choosing its own content to write in place 
of mine.  I've pored over phpinfo and php.ini trying to find a config 
setting that might be causing this weirdness, but so far nothing seems 
obvious.

-- 
CC

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] fwrite not writing (simpler example), PHP 4.0.4pl1, Apache/1.3.14

2001-04-17 Thread Chris Anderson

I am using the latest version of Apache and PHP. Sorry I couldn't be of more
help.
- Original Message -
From: "CC Zona" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 17, 2001 3:01 AM
Subject: Re: [PHP] fwrite not writing (simpler example), PHP 4.0.4pl1,
Apache/1.3.14


> In article <012101c0c69b$b01b8d00$8b1412d1@null>,
>  [EMAIL PROTECTED] ("Chris Anderson") wrote:
>
> > I tried it, even with the byte length identifer it worked perfectly for
me.
> > As a last ditch effort try changing the w to w+. If not then it sounds
like
> > a configuration issue for the webserver or php. Dunno what settings
though,
> > sorry couldn't be of more help.
>
> Thanks for testing.  Was that with v4.0.4pl?  I'd sure like to know
whether
> there's any possbility it's bug.  Seems unlikely, but then again so does
> the stubborness of frwite() in choosing its own content to write in place
> of mine.  I've pored over phpinfo and php.ini trying to find a config
> setting that might be causing this weirdness, but so far nothing seems
> obvious.
>
> --
> CC
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]