fopen: [function.file]: failed to open stream: No such file or directory 
June 26th, 2009, 04:14 PM
| | Member | | Join Date: Jun 2009
Posts: 52
| |
I've been having trouble trying to open a file. It outputs - 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
-
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.
| 
June 26th, 2009, 04:18 PM
|  | Moderator | | Join Date: Jun 2007 Location: York, England, with wolves.
Posts: 4,862
Provided Answers: 9 | | | re: fopen: [function.file]: failed to open stream: No such file or directory
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.
| 
June 26th, 2009, 04:22 PM
| | Member | | Join Date: Jun 2009
Posts: 52
| | | re: fopen: [function.file]: failed to open stream: No such file or directory
so this is where I try to open my file in line 72 -
if($project==$type){
-
$classpath="/projects/".$project."/ts_classes";
-
$classfile=fopen("$classpath","r");
-
}
-
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.
| 
June 26th, 2009, 04:32 PM
| | Member | | Join Date: Jun 2009
Posts: 52
| | | re: fopen: [function.file]: failed to open stream: No such file or directory
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.=)
| 
June 26th, 2009, 05:30 PM
|  | Moderator | | Join Date: Jun 2007 Location: York, England, with wolves.
Posts: 4,862
Provided Answers: 9 | | | re: fopen: [function.file]: failed to open stream: No such file or directory
Windows paths are case-insensitive I think, while pretty much every other OS is case sensitive.
| 
June 27th, 2009, 06:49 PM
|  | Moderator | | Join Date: Nov 2006 Location: Iceland
Posts: 3,701
Provided Answers: 4 | | | re: fopen: [function.file]: failed to open stream: No such file or directory
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)
|  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 225,689 network members.
|