Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #2977

Re: fopen error

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!newsfeed.CARNet.hr!gregory.BNet.hr!not-for-mail
From "A" <a@a.a>
Newsgroups comp.lang.php
Subject Re: fopen error
Date Sun, 28 Aug 2011 17:23:54 +0200
Organization B.net Hrvatska d.o.o.
Lines 29
Message-ID <j3dml8$3kh$1@gregory.bnet.hr> (permalink)
References <Hmg6q.167690$7C3.38705@en-nntp-06.dc1.easynews.com>
NNTP-Posting-Host dh207-15-190.xnet.hr
X-Trace gregory.bnet.hr 1314545128 3729 88.207.15.190 (28 Aug 2011 15:25:28 GMT)
X-Complaints-To abuse@globalnet.hr
NNTP-Posting-Date Sun, 28 Aug 2011 15:25:28 +0000 (UTC)
X-Priority 3
X-MSMail-Priority Normal
X-Newsreader Microsoft Outlook Express 6.00.2900.5931
X-MimeOLE Produced By Microsoft MimeOLE V6.00.2900.6109
X-RFC2646 Format=Flowed; Response
Xref x330-a1.tempe.blueboxinc.net comp.lang.php:2977

Show key headers only | View raw


> $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. 

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

fopen error "eBob.com" <eBob.com@totallybogus.com> - 2011-08-27 20:56 -0400
  Re: fopen error BKDotCom <kent.brad@gmail.com> - 2011-08-27 20:55 -0700
    Re: fopen error "eBob.com" <eBob.com@totallybogus.com> - 2011-08-28 12:00 -0400
  Re: fopen error "A" <a@a.a> - 2011-08-28 17:23 +0200
    Re: fopen error "eBob.com" <eBob.com@totallybogus.com> - 2011-08-28 12:07 -0400
  Re: fopen error "A" <a@a.a> - 2011-08-28 17:27 +0200
  Re: fopen error Denis McMahon <denis.m.f.mcmahon@gmail.com> - 2011-08-28 16:36 +0000

csiph-web