Jump to content

Problem with fopen()


BloodyMind

Recommended Posts

Problem:

 

fopen(C:/wamp/www/phpTask/dataAccess/data.txt) [function.fopen]: failed to open stream: No error in C:\wamp\www\phpTask\dataAccess\dataAccess.inc.php on line 26

 

Warning: fopen(http://localhost/phpTask/dataAccess/data.txt) [function.fopen]: failed to open stream: HTTP wrapper does not support writeable connections

 

does anyone got a clue

I use windows XP btw if it is a problem with apache

 

 

Link to comment
Share on other sites

From a user on a different board I googled -

 

the file you're trying to write to is not local it is something like http://xx.xxxxxxxxxx.com/projphotos/5.jpg even if this is your host, you cannot write by http, you have to use the local file system to write files

it seems $images_dir contains http://xx.xxxxxxxxxx.com/projphotos/ when it should contain

realpath("projphotos") or something similar

 

I searched for the string "failed to open stream: HTTP wrapper does not support writeable connections"

Link to comment
Share on other sites

damianjames is sort of right.  fopen will work with the html wrapper if allow_url_fopen is turned on.  see here: http://us.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen

 

Although this isn't usually a good thing to turn on unless you are sure you really want to.

 

The first error could be caused by lots of stuff.  The file doesn't exist...the file lacks proper permissions...  Looking at some actual code would help a lot.

Link to comment
Share on other sites

well actually It's coz of permissions I use windows XP

and then if i edit the attributes of the file and uncheck the Read Only

then when i try to access it again I find read only checked

 

it's something with the apache I guess but I don't think the allow_url_fopen is a good idea

 

I solved it by disabling an apache extention which was authz_file or something like that i can't remember

but i'm not sure i'm doing the right solution.

 

and I still find the same issue with directories when i try to write a new file to a directory i always find it read only when i uncheck it I find it read only again :S

 

Thanx guys for trying to help

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.