BornKillaz Posted December 31, 2008 Share Posted December 31, 2008 Hi! On my previous server and on some other hosts, I was able to write to files (for example with PHP) without having to chmod the files first. Now I cannot, and files are required to be chmoded properly so I can write to them. I cannot even touch() a file with PHP. Is there any way to have this permissions removed? I don't want to chmod the all thing, all I want is to change the configurations so I can fwrite() or file_put_contents() normally. I's a dedicated un-managed server, so basically any advanced configurations can be done. Please help! :-\ Thank you in advance! Quote Link to comment Share on other sites More sharing options...
tomfmason Posted December 31, 2008 Share Posted December 31, 2008 If I want the server to be able to read and write files I do something like: chown -R user:group /path/to/location chmod -R ug+rw /path/to/location "group" is the group that you have apache running under. Quote Link to comment Share on other sites More sharing options...
BornKillaz Posted December 31, 2008 Author Share Posted December 31, 2008 If I want the server to be able to read and write files I do something like: chown -R user:group /path/to/location chmod -R ug+rw /path/to/location "group" is the group that you have apache running under. Hi, and thank you for your fast reply. So, is that the only option? CHMOD? And it is secure? I mean, I have run my code for the last 3 years with no problems on the old server.... However I was running PHP as a CGI module. Don't know if has something to do with that. Quote Link to comment Share on other sites More sharing options...
neogranas Posted December 31, 2008 Share Posted December 31, 2008 If I understand what you are saying, you mean that when you create the files they are not made with proper permissions for you to manipulate(read/write/execute) them? That may be a setting on the server that automatically assigns that privilege, and you may be able to get it changed if you have root access. Quote Link to comment Share on other sites More sharing options...
steviewdr Posted January 2, 2009 Share Posted January 2, 2009 I would recommend looking at suphp. It runs php in cgi mode where a php script executes as the owner. Therefore any files created by a php script will be under your username. -steve Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.