472,958 Members | 1,979 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,958 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 3313
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
2
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.