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 #175230 is a reply to message #175227] Sun, 28 August 2011 15:23 Go to previous messageGo to previous message
A is currently offline  A
Messages: 17
Registered: June 2011
Karma:
Junior Member
> $fpFileOut = fopen($fileout,"c");
> if (!$fpFileOut) {echo "Error opening $fileout\n"; echo E-WARNING; exit;}

do an echo $fileout; before fopen to see what the folder/file is.

remember the following:

- in linux/unix the filenames are case sensitive and file system is a bit
different than windows
- when you define $fileout remember if you use backslashes you need to
escape them so it is not
$fileout = "c:\folder\file.txt";
rather
$fileout = "c:\\folder\\file.txt";

in php you can use forward slashes instead which don't require escaping:

$fileout = "c:/folder/file.txt";

- you need to have write permissions (755, 666 etc.) if it is unix/linux
system. many hosters set this for PHP but you haven't specified what kind of
host you test this on.

it is probably my lazyness, but unless you really need fopen you can get by
just fine with much easier functions like readfile, file(),
file_get_contents(), file_put_contents()... all work done in a single line
rather than fopen, fread, fwrite, fclose.
[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: Sun Nov 24 21:02:36 GMT 2024

Total time taken to generate the page: 0.05697 seconds