Saturday, February 25, 2012

Warning: fopen(file.txt): failed to open stream


Share at Facebook

In your PHP script, if you get an error like below, then it definitely means that you are missing the read/write like operation parameter.

Warning: fopen(file.txt): failed to open stream: Bad file descriptor in C:\test.php

Lets consider the below code,

$fh_out = fopen($filename, $mode);

Here in your case, you are providing invalid value inside $mode and it is causing the error. change it into anything like 'w', 'r', etc.




No comments: