I'm used to Perl, not to PHP, and I'm used to something like this:
open(FILE,">filename.txt") || die "$!";
where "$!" is the common variable for an error message.
How can I do this kind of thing in PHP?
Of course I can do
if( fopen(foo, bar) ){
// something
} else {
echo("there was an error");
}
but how do I figure out which error it was -- unsufficient permissions, file locked, file doesn't exist, etc?
My hosting provider has got their "display_errors" set to "Off" in the shared php.ini, and what I did was use this to turn errors back on:
error_reporting ( 4096 );
ini_set ( display_errors, 1 );
which seems to help, but when I try to print out to the browser any variable from $POST or $GET my script silently dies, even with the error setting above. I'm guessing this is a security measure? It's very confusing. How can I get around that?