Jump to content

chmod()


calvin182

Recommended Posts

I'm having some troubles with the chmod function... here's what I'm trying but it tells me Operation not permitted

chmod("/home/DOMAIN/public_html/misc/file.php", 0666);

any ideas as to why it's not working or how to get it to work?

Link to comment
Share on other sites

Is the script that is using the chmod() in the same directory?Have you tried a relative path instead of absolute?What are the permission settings on the folder where the file is located?I've tested your code on 2 different servers with no errors . . :) -hs

Link to comment
Share on other sites

well I am trying to use this in the backend to the gallery so it will chmod the init.php file, save changes, and chmod the file back for security. The permissions of the folder it's in is set as 0755. When I change the folder to 0777 it creates an error_log file. The file that the script chmods is in the same directory and I've tried both relative and absolute paths.I read something about php safe mode and this function so perhaps thats the issue, although i don't know if thats set anyway.

Link to comment
Share on other sites

although the chmod() function does not work on my server... I have a new chmod related question...lets say i have a .php file with a bunch of variables that are contain some sensitive information. I want the file to be able to be included in scripts on my server but i dont want some random person to try and include it in a page on their server and echo out the variables. is there a chmod setting I should apply so that this does not happen but could allow scripts on my server to save to it? at present it's set to 0666.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...