473,387 Members | 1,476 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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

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
5 6860
Markus
6,050 Expert 4TB
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
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
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
6,050 Expert 4TB
Windows paths are case-insensitive I think, while pretty much every other OS is case sensitive.
Jun 26 '09 #5
Atli
5,058 Expert 4TB
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

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

Similar topics

0
by: glesaux | last post by:
Hi, In one of my script i'm trying to apend a daily log file (see script part bellow). When the script runs, this message appears : fopen(temp/pglog.20050106.log): failed to open stream:...
28
by: John Salerno | last post by:
What is the best way of altering something (in my case, a file) while you are iterating over it? I've tried this before by accident and got an error, naturally. I'm trying to read the lines of a...
0
by: whgriffin | last post by:
I'm using Aspose.Excel to export a recordset to excel. I have code that has work 100 times before, but just ran into an issue. If I have a button and run the Sub Report() from the onPostBack() in...
1
by: kencana | last post by:
Hi all, I was wondering why I always get "failed to open stream: HTTP request failed!" error in either loading a normal or xml file. i don't understand why i can't get the whole result. the result...
0
by: Daniel Nogradi | last post by:
Hi list, AFAIK using file( ) to open a file is deprecated in favor of open( ) and while grepping through the stdlib I noticed a couple of occurences of file( ) in the latest revision. I made a...
3
by: siyaverma | last post by:
i am trying to upload csv file from user's computer to main server the code i am using is if(((isset($_GET)) && ($_GET=="yes")) ) { $typefield = $_GET; echo...
6
by: Andy2500 | last post by:
Hi, I'd like to upload an image to a folder, then I have 3 diffrents examples but all of them give an error "failed to open stream: Permission denied", althrough the C:\Inetpub\wwwroot is not...
2
by: swethak | last post by:
Hi, when i run my code it gives error as fopen(lib/providers//provider.RVLogic.php): failed to open stream: Permission denied in F:\Facebook\furniture11\Data...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.