FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » fopen error
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: fopen error [message #175228 is a reply to message #175227] Sun, 28 August 2011 03:55 Go to previous messageGo to previous message
BKDotCom is currently offline  BKDotCom
Messages: 7
Registered: October 2010
Karma:
Junior Member
On Aug 27, 7:56 pm, "eBob.com" <eBob....@totallybogus.com> wrote:
> This fopen fails and I don't understand why ...
>
> $fpFileOut = fopen($fileout,"c");
> if (!$fpFileOut) {echo "Error opening $fileout\n";  echo E-WARNING; exit;}
>
> The file does not exist but shouldn't "c" create it?  My understand of "c"
> is that it's created if it doesn't exist and overwrites the file if it does
> exist.  (That's not exactly what the doc says but that is the way I
> understand it.)

Does the directory you're attempting to create the file in exist?
If it does, do you have proper rights to write in it?
Or does the file already exist and you don't have rights to modify it?


> My attemp to echo E-WARNING produces "0".  I have no idea what's up with
> that.

"If the open fails, an error of level E_WARNING is generated. You may
use @ to suppress this warning. "

See http://www.php.net/manual/en/book.errorfunc.php

Nutshell E_WARNING is a constant signifying the severity of the error
not a variable describing the last error

To see the actual error open the error log file.

Or
error_reporting(E_ALL ^ E_NOTICE); // report all errors except for
notices
// just in case it's
currently set to to report no errors
ini_set('display_errors',1); // output the error
// (in addition to writing it
to error log)
Or, if you've got PHP >= 5.2, you can try
print_r(error_get_last());

anyhow, once you view see the error, you should know the reason for
the error. :)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: mktime 2-digit vs 4-digit year
Next Topic: OpenSSL, openssl_pkey_get_private
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Nov 28 12:13:05 GMT 2024

Total time taken to generate the page: 0.04635 seconds