Scooby08 Posted December 3, 2009 Share Posted December 3, 2009 Is there a way to change file permissions to a file that is not created by php, but rather one that I uploaded myself? I'm getting this error: Warning: file_put_contents(head.tmpl) [function.file-put-contents]: failed to open stream: Permission denied in /path/functions.php on line 211 Maybe something like so: <?php system("chmod -R 777 \"/head.tmpl\" "); ?> I don't know? Not sure? Any ideas?? Quote Link to comment https://forums.phpfreaks.com/topic/183885-changing-file-permissions/ Share on other sites More sharing options...
mikesta707 Posted December 3, 2009 Share Posted December 3, 2009 There is a chmod command in php you can use Quote Link to comment https://forums.phpfreaks.com/topic/183885-changing-file-permissions/#findComment-970710 Share on other sites More sharing options...
Scooby08 Posted December 3, 2009 Author Share Posted December 3, 2009 I have tried this: <?php chmod("head.tmpl", 0777); ?> But I get this error: Warning: chmod() [function.chmod]: Operation not permitted in /path/functions.php on line 211 Does the directory that the file is in need to be writable as well or something? Quote Link to comment https://forums.phpfreaks.com/topic/183885-changing-file-permissions/#findComment-970714 Share on other sites More sharing options...
mikesta707 Posted December 3, 2009 Share Posted December 3, 2009 I believe so, yes Quote Link to comment https://forums.phpfreaks.com/topic/183885-changing-file-permissions/#findComment-970717 Share on other sites More sharing options...
Scooby08 Posted December 3, 2009 Author Share Posted December 3, 2009 No go.. Any other ideas I could try out there? Quote Link to comment https://forums.phpfreaks.com/topic/183885-changing-file-permissions/#findComment-970722 Share on other sites More sharing options...
PFMaBiSmAd Posted December 3, 2009 Share Posted December 3, 2009 If you are uploading the file using FTP or your hosting control panel, the owner of the file is the user that the FTP server or the control panel us running under. The user that the web server/Php is running under cannot alter the permissions (that would kind of defeat the purpose of having permissions.) You need to change the permissions on the folder and/or file using the same method that you used to upload it. Quote Link to comment https://forums.phpfreaks.com/topic/183885-changing-file-permissions/#findComment-970729 Share on other sites More sharing options...
Scooby08 Posted December 3, 2009 Author Share Posted December 3, 2009 Ok thank you for that answer.. Quote Link to comment https://forums.phpfreaks.com/topic/183885-changing-file-permissions/#findComment-970732 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.