By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,383 Members | 1,996 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,383 IT Pros & Developers. It's quick & easy.

fopen: [function.file]: failed to open stream: No such file or directory

P: 52
I've been having trouble trying to open a file. It outputs
Expand|Select|Wrap|Line Numbers
  1. fopen(/projects/CCPROT/ts_classes) [function.file]: failed to open stream: No such file or directory in /mnt/raid/www/intra/admin/ts2/test2.php on line 72
  2.  
I've tried outputting the file name and it's correct. I've looked online for help and it seems that people had to use trim() on the variable name and I did that but it still doesnt work. I'm opening this file when another file is open already (in a while loop) and I was wondering if that is causing the problem. If it isn't, I was wondering if anyone can shed some light on this problem. Thanks for the help.
Jun 26 '09 #1
Share this Question
Share on Google+
5 Replies


Markus
Expert 5K+
P: 6,050
Going to need a little more information. Even though the file path *looks* right, it isn't. Are you using an absolute path or relative path? I recommend absolute as you don't have to resolve directories then.

What does your path look like? Where is the script being executed from (what is the current working directory)?

- mark.
Jun 26 '09 #2

P: 52
so this is where I try to open my file in line 72
Expand|Select|Wrap|Line Numbers
  1. if($project==$type){    
  2.                 $classpath="/projects/".$project."/ts_classes";
  3.                 $classfile=fopen("$classpath","r");
  4. }
  5.  
I believe I'm using an absolute path already cause I have the directory name in it already. The script is being executed from /projects/www/intra/admin/ts2 and the file im trying to open is in /projects/ts. So they're in the same root directory(not sure what it's called) but in different folders.
Jun 26 '09 #3

P: 52
hm...so I think I fixed it by changing things to lower case. I didn't know it was case-sensitive. Hopefully, it fixed it for real and doesnt pop up agn later. Thanks for your help.=)
Jun 26 '09 #4

Markus
Expert 5K+
P: 6,050
Windows paths are case-insensitive I think, while pretty much every other OS is case sensitive.
Jun 26 '09 #5

Atli
Expert 5K+
P: 5,058
I believe some Macs are case-insensitive to, depending on the file-system being used. (Maybe a Windows compatibility thing... I don't know :P)
Jun 27 '09 #6

Post your reply

Sign in to post your reply or Sign up for a free account.