$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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
First of all take a deep breath and a tea 😉
The news is:
DATA.txtis 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:
Hope this is helpful.