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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • phpnewbie26
    New Member
    • Jun 2009
    • 52

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

    I've been having trouble trying to open a file. It outputs
    Code:
    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.
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    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.

    Comment

    • phpnewbie26
      New Member
      • Jun 2009
      • 52

      #3
      so this is where I try to open my file in line 72
      Code:
      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.

      Comment

      • phpnewbie26
        New Member
        • Jun 2009
        • 52

        #4
        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.=)

        Comment

        • Markus
          Recognized Expert Expert
          • Jun 2007
          • 6092

          #5
          Windows paths are case-insensitive I think, while pretty much every other OS is case sensitive.

          Comment

          • Atli
            Recognized Expert Expert
            • Nov 2006
            • 5062

            #6
            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)

            Comment

            Working...