Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 228
  • Last Modified:

problem in writing to a file (URGENT)

I need to write to a file however i am not being able to do so. I can create a file and later write to it however when I try to write to an existing file then I am not allowed to. The thing is everything works in localhost ...its when I keep it in the server that the problem starts coming. I believe this has got to do something with the permission so I changed the permission to read,write, execute for all (user/group/other) but then it didnt help. Does anyone have any idea on this ?
0
Sid123
Asked:
Sid123
  • 2
1 Solution
 
wildzeroCommented:
Change the file permission to 777 OR you may need to change the folder that actually contains the file, try and change that to 777 as well.

Note - 777 is really not a good idea however it IS a quick fix to see if thats the problem.
0
 
wildzeroCommented:
See here about file security (777 permissions)
http://www.experts-exchange.com/Web/Web_Languages/PHP/Q_21789944.html
0
 
WilliamFrantzCommented:
> when I try to write to an existing file then I am not allowed to.

What do you mean?  Do you see an error message?  What's the message?  How are you writing to the file?  fopen() fwrite()?

> I changed the permission to read,write, execute for all
> (user/group/other) but then it didnt help.

I believe that's what wildzero was suggesting.
How did you change the file permission?
Did you use the PHP chmod() function or did you use the linux 'chmod 777' command?
Who is the owner of the file?
0
 
ysreCommented:
Although unlink(..)ing a not needed file before writing to it may help.
Of course you'd have to have the right permissions (unless it's a totally esoteric problem created by the server your script / page runs on) ;).

Ys
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now