Also: If you prefer to have exceptions instead of error / warning messages, do not use the basic functions of the file system. Open the file as follows:
$f = new SplFileObject("output", "w");
$f->fwrite("error");
, , .NET. ( , error_reporting(E_ALL); .)