Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6886597
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:46:45+00:00 2026-05-27T05:46:45+00:00

$file=file(‘DATA.txt’); I keep getting failed to open stream. No such file or directory in

  • 0
$file=file('DATA.txt');

I keep getting “failed to open stream. No such file or directory in …”. This works when I run it on a server and browser. But the error occurs when I run the script using command line.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T05:46:46+00:00Added an answer on May 27, 2026 at 5:46 am

    First of all take a deep breath and a tea 😉

    The news is: DATA.txt is only a file-name.

    A file normally is placed in a directory. As stupid as this sounds, well, as stupid this is: What is the directory?

    The answer: the current working directory. This differs between servers and CLI.

    So better add your directory as well:

    $name = 'DATA.txt';
    $dir = 'C:/';
    $path = $dir.$name;
    $file = file($path);
    

    Hope this is helpful.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

FILE *fd; if (fd=fopen(fileName,r) == NULL) { printf(File failed to open); exit(1); } This
file_get_contents() is returning failed to open stream when I call it on an HTTPS
file = io.open('spam.txt', 'w') file.write(u'Spam and eggs!\n') file.close() ....(Somewhere else in the code) file
File upload is works fine from my simulator (blackberry 8830).It upload the file to
File associations on my machine (winxp home) are such that a python script is
File.open(path, 'r').each do |line| row = line.chomp.split('\t') puts #{row[0]} end path is the path
File: Example1.java public class Example1 implements Runnable { public void run() { for(int i
My file structure looks liked this: cse408 - lib - pics - App.java -
File open with fopen() fails when I provide a relative path. I am running
File foo.txt exists on the remote machine at: /home/user/foo.txt It doesn't exist on the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.