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 #175232 is a reply to message #175228] Sun, 28 August 2011 16:00 Go to previous messageGo to previous message
eBob.com is currently offline  eBob.com
Messages: 11
Registered: August 2011
Karma:
Junior Member
Thanks very much BK. Those tips are going to make my debugging much easier.
(Why don't books mention such aids at the outset?)

My mistake was a dumb logic/typo error which tired eyes were unable to see
last night, but which fresh eyes spotted this morning.

Thanks again, Bob


"BKDotCom" <kent(dot)brad(at)gmail(dot)com> wrote in message
news:781ed9c7-a89d-48eb-bf2b-3aefad6be6bf(at)b9g2000prd(dot)googlegroups(dot)com...
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: Sat Oct 19 21:26:38 GMT 2024

Total time taken to generate the page: 0.04330 seconds