Permission Problem

liunx

Guest
Hi,<br /> I have php script for creating files. It actually opens a file for writing and then copies the content for a template then the new file is chmod(ed) to 777. Now the main problem is with the permission. I need to set the permission of the folders as well of the files to 777 which makes it vulnerable. I was told by the server people to change the permission to 755 but doing so, the script doesnt work. <br /><br />chown -R <username>:apache <directoryname><br />chmod g+s <directoryname> <br /><br />I asked my server administrator to execute the above commands, which he did but still the scripts are not executing. Its showing the error "fopen(test.php): failed to open stream: Permission denied" error(while trying to create the file test.php)<br /><br />The whole thing is, to get the script execute without giving the folders a 777 permission. How should I go about for this.This is urgent and any help from you will be highly appreciated.<!--content-->
Hello and welcome to the forums,<br /><br />Try changing the permission first to 777, then doing what you need, and then CHMOD it back again when finished.<br /><br />JimE<!--content-->
Welcome to the forum, shik. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
Welcome to the forums shik.<br /><br />Changing the directory owner to "apache" won't solve it but changing it to "nobody" may as that is the user that apache runs under.<!--content-->
Welcome to the forum, shik <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
Hi and thank you for your warm welcome. Okay, talking about my problem again, my script needs to do these things ... it needs to create a file and that file needs to be writable. So both the file as well as the directory in which it is written should be writable. Right now like I said before for the directories I am giving 777 permission and once the file is created its chmod(ed) to 777(via the script). Now I need to keep permission of both these to 755 (as my server administrator suggested) but still get the script running. I am very vague about this and would be highly obliged if anyone could let me know how I should go about. <br /><br />shik<!--content-->
Hi,<br /> Okay I had previously posted regarding the permission of the folders. Just to brief it up. I have a script to create files in php. Now the folder where the files are created has the permission set to 755 but as suggested by some forum users I asked my server admin to change the folder ownership to nobody. However I am still getting the problem with the permission, that is, I cant upload the files via FTP and the script isnt running as well. I am totally confused so can anyone help me out? This is what I want to do ... create files via PHP script but without giving 777 permission to the folder where the file is created.<!--content-->
I've merged the topics as they are the same. Please do not start new duplicate threads to get your questions answered.<!--content-->
 
Back
Top