NYCPHP Meetup

NYPHP.org

[nycphp-talk] phantom file writing errors

Marc Antony Vose suzerain at suzerain.com
Mon Jul 26 23:46:07 EDT 2004


Hi there:

The file path is correct.

I know that the PHP script is creating the files, because I have 
deleted all the files, and they get created.  So, yeah, I'm 100% 
certain of that.  This also validates the prior point, about the path.

The PHP parser is giving me the warning even though it is creating 
the files...how and why can it do this?

I mean, I could suppress its output by prepending the '@' sign, but 
I'd like to be notified of REAL issues in the script...

Marc



>Marc Antony Vose writes:
>
>Can anyone tell my why I would get this error:
>Warning: fwrite(): supplied argument is not a valid stream resource in
>Warning: fclose(): supplied argument is not a valid stream resource in
>
>when the script is in fact opening and writing out
>the file just fine?
>
>Are you %100 certain about the file
>being written to?
>
>Hou did you assign the variable
>$output_h?
>
>The code was:
>
>// output the file
>$output_h = fopen($output_path,"w");
>fwrite($output_h,$output);
>fclose($output_h);
>
>If you assign the variable $output_path
>like thie:
>
>$output_path = 'test.txt';
>
>the code snippet will work.
>
>You can use is_resource($output_h) to make
>certain the resource got created.
>
>Perhaps you misspelled the variable name
>$output_path --
>Try $Output_path = 'test.txt';
>and compare the results.
>
>(sorry if you are asking a different
>question -- i.e. how can the fwrite
>function work when it is not being
>passed a vaild (file handle) resource --
>I don't see how that could work)
>
>T. Gales & Associates
>'Helping People Connect with Technology'
>
>http://www.tgaconnect.com
>
>
>_______________________________________________
>New York PHP Talk
>Supporting AMP Technology (Apache/MySQL/PHP)
>http://lists.nyphp.org/mailman/listinfo/talk
>http://www.newyorkphp.org




More information about the talk mailing list