Reading a .dat file as "rb" read binary
Posted
by donpal
on Stack Overflow
See other posts from Stack Overflow
or by donpal
Published on 2010-04-06T15:32:51Z
Indexed on
2010/04/06
15:33 UTC
Read the original article
Hit count: 354
I have a web-accessible php script that accesses a folder above the webroot (not web accessible) called \folder\
. This is done via setting the path to \folder\
in .htaccess the usual way so that \folder\
becomes part of the project.
\folder\
contains
- a .php script (communicates with the web-accessible script inside the webroot)
- some .inc files (used by the .php in the same folder, above the webroot)
- a dat file (used by the .inc in the same folder, above the webroot)
All files are accessible to each other as needed:
- the web-accessible php inside the webroot can communicate with the php above the webroot
the php above the webroot can communicate with the inc in the same folder
But the inc above the webroot can't communicate with the dat in the same folder, and I have no idea why that's the case
The inc myinc.inc
is supposed to open the dat mydat.dat
in the same folder like this
fopen('mydat.dat', "rb");
but I get an error that no file called mydat.dat
exists inside \folder\myinc.inc
. Of course it does not, the .dat
is sibling to .inc
and is not supposed to be inside
it. Why is php expecting to find the .dat
file inside the .inc
.
The stranger thing is that if I move the .dat
in the web-accessible folder, it becomes readable now.
Any ideas why php is trying to find the .dat
inside the .inc
?
© Stack Overflow or respective owner