Help with File Open

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
casey64
Forum Newbie
Posts: 2
Joined: Sun Jan 25, 2009 8:30 am

Help with File Open

Post by casey64 »

Could someone help me understand why this isn't work or how to isolate the issue?

Originally I wanted to open a file called stats.txt, but I couldn't get that to work so I thought I would try opening my myFunctions.php file because I am using it as an include in my main file and it is obviously working as an include, so I know the path and access should be correct since the include is working. I get 'unable to open file in each case'. My include code is:

include("./myFunctions.php");

My file open code is:

$fh = fopen("./myFunctions.php", "r");
if($fh==false)
{ echo("Unable to open file"); }

I've also tried

$fh = fopen("myFunctions.php", "r");
if($fh==false)
{ echo("Unable to open file"); }

$fh = fopen("/myFunctions.php", "r");
if($fh==false)
{ echo("Unable to open file"); }

$fh = fopen('./myFunctions.php', 'r');
if($fh==false)
{ echo("Unable to open file"); }

Thanks!
casey64
Forum Newbie
Posts: 2
Joined: Sun Jan 25, 2009 8:30 am

Re: Help with File Open

Post by casey64 »

Nevermind, guess I will use the other forum, have been getting help there throughout the day and have got nothing here.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Help with File Open

Post by Benjamin »

Turn on error reporting.
Motanelu
Forum Newbie
Posts: 1
Joined: Mon Jan 26, 2009 2:12 am

Re: Help with File Open

Post by Motanelu »

Also keep in mind that Linux/Unix filesystems are case sensitive...
Post Reply