473,387 Members | 1,520 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.

Cannot open file

Hi
I have my home directory on my departments server. Somehow I am not
able to write to a file using a php code,
$myFile = "trial3.txt";
$fh = fopen($myFile, "a+") or die("can't open file");

Instead of a+ if i use r or w or anything, it does not work. Could this
be a permission thing? The entire directory had a 777 permission and
even i after i created a file and chmod'ed 777 to it, the code couldnt
open it. What could be the matter? It doesnt go away if i change it to
'w' or 'w+' or 'r' or 'r+'.

Rahul

Dec 2 '06 #1
6 3337
Also I wanted to add that if i write a perl script to write to a file,
it does it for me. But some how that is not possible in php. I gave
write permissions to all the php files and all the text files.

Rahul
rahulthathoo wrote:
Hi
I have my home directory on my departments server. Somehow I am not
able to write to a file using a php code,
$myFile = "trial3.txt";
$fh = fopen($myFile, "a+") or die("can't open file");

Instead of a+ if i use r or w or anything, it does not work. Could this
be a permission thing? The entire directory had a 777 permission and
even i after i created a file and chmod'ed 777 to it, the code couldnt
open it. What could be the matter? It doesnt go away if i change it to
'w' or 'w+' or 'r' or 'r+'.

Rahul
Dec 2 '06 #2
rahulthathoo wrote :
Also I wanted to add that if i write a perl script to write to a file,
it does it for me. But some how that is not possible in php. I gave
write permissions to all the php files and all the text files.

Rahul
rahulthathoo wrote:
>Hi
I have my home directory on my departments server. Somehow I am not
able to write to a file using a php code,
$myFile = "trial3.txt";
$fh = fopen($myFile, "a+") or die("can't open file");

Instead of a+ if i use r or w or anything, it does not work. Could this
be a permission thing? The entire directory had a 777 permission and
even i after i created a file and chmod'ed 777 to it, the code couldnt
open it. What could be the matter? It doesnt go away if i change it to
'w' or 'w+' or 'r' or 'r+'.

Rahul
Did you try running your PHP script in a shell, instead of in a browser?

--
Naixn
http://fma-fr.net
Dec 2 '06 #3
No i opened up the php script in the browser. how do i parse it in the
shell?
rahul

naixn wrote:
rahulthathoo wrote :
Also I wanted to add that if i write a perl script to write to a file,
it does it for me. But some how that is not possible in php. I gave
write permissions to all the php files and all the text files.

Rahul
rahulthathoo wrote:
Hi
I have my home directory on my departments server. Somehow I am not
able to write to a file using a php code,
$myFile = "trial3.txt";
$fh = fopen($myFile, "a+") or die("can't open file");

Instead of a+ if i use r or w or anything, it does not work. Could this
be a permission thing? The entire directory had a 777 permission and
even i after i created a file and chmod'ed 777 to it, the code couldnt
open it. What could be the matter? It doesnt go away if i change it to
'w' or 'w+' or 'r' or 'r+'.

Rahul

Did you try running your PHP script in a shell, instead of in a browser?

--
Naixn
http://fma-fr.net
Dec 2 '06 #4
rahulthathoo wrote :
No i opened up the php script in the browser. how do i parse it in the
shell?
Symply type :
$php your_file.php

( '$>' being the shell prompt, in case of )

Not too hard, eh? :)

--
Naixn
http://fma-fr.net
Dec 2 '06 #5
Alright it works in the shell, but now when i open the url in the
browser. What could be wrong?

Rahul

naixn wrote:
rahulthathoo wrote :
No i opened up the php script in the browser. how do i parse it in the
shell?

Symply type :
$php your_file.php

( '$>' being the shell prompt, in case of )

Not too hard, eh? :)

--
Naixn
http://fma-fr.net
Dec 2 '06 #6
I meant not* - it doesnt write the file when i open the url in the
browser

Rahul
rahulthathoo wrote:
Alright it works in the shell, but now when i open the url in the
browser. What could be wrong?

Rahul

naixn wrote:
rahulthathoo wrote :
No i opened up the php script in the browser. how do i parse it in the
shell?
>
Symply type :
$php your_file.php

( '$>' being the shell prompt, in case of )

Not too hard, eh? :)

--
Naixn
http://fma-fr.net
Dec 2 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Christopher Brandsdal | last post by:
Hi! I get an error when I run my code Is there any other way to get te information from my form? Heres the error I get and the code beneath. Line 120 is market with ''''''''''''Line...
5
by: Sanyi | last post by:
I am having some trouble rereading a file for input. Here's the problem: I have a text file with some data (football scores) in its lines. First I read them line-by line to figure out how many...
2
by: CM | last post by:
Hi there: I have a web project which can be open and run without problem. I didn't open the web application for a period and during which I didn't modified any IIS items, but now I cannot open any...
0
by: CM | last post by:
Hi there: I have a web project which can be open and run without problem. I didn't open the web application for a period and during which I didn't modified any IIS items, but now I cannot open any...
4
by: CM | last post by:
Hi there: I have a web project which can be open and run without problem. I didn't open the web application for a period and during which I didn't modified any IIS items, but now I cannot open any...
1
by: vikram | last post by:
hello all, I have a small question. I have an application which actually converts binary data to word document and saves on the server. The next phase of the project involves opening the word...
2
by: Jay Bienvenu | last post by:
I cannot create new Web applications in Visual Studio .NET 2003. I get this error message: "Visual Studio .NET cannot create or open the application. The likeliest problem is that required...
2
by: Enska | last post by:
I have problems connecting my access database I get information .. I cant use my database and I'm administrator on my computer so permission shutnot bee problem, but I dont know Where is the...
2
by: John Donnell | last post by:
We have recently added another PC to the network and have run into difficulty when trying to open access files from the server using the new box. We get the error message 'MS Access cannot open...
1
by: edfialk | last post by:
Hi all, I'm desperately trying to get a simple mysql connection working in php 4.3.9 and I think I have a doozy for you guys. First of all, I didn't set up ANY of this system, I'm just working...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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,...

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.