php chmod function can change the access rights of files and folders, but when using the prompt warning, as follows:
Warning:chmod () [Function.chmod]: Operation not permitted in/export/mytest/chmodtest.php on line 5
The modified folder has all the parent folder's access permissions changed to the 777,chmod function does not modify the access permissions of the folder at all, what is the reason? *nix just let all the files under the Web root belong to Apache run user all right, fake Apache user with Apache group running httpd Then
Chown-r Apache.apache/path to documentroot/
Win has all permissions to the IIS running user to DocumentRoot.
The chmod () function changes the file mode. returns TRUE if successful, otherwise FALSE.
Grammar
chmod (File,mode)
Parameters |
Description |
File |
Necessary. Specifies the documents to be inspected. |
Mode |
Optional. Specify the new permissions. The mode parameter consists of 4 numbers:
The first number is always 0.
The second number specifies the owner's permissions
The second number specifies the permissions of the user group to which the owner is a member
The fourth number stipulates the rights of all other persons
Possible values (if you want to set multiple permissions, make a total of the following numbers):
1-Execute Permissions
2-Write permissions
4-Read Permissions
|
PHP chmod () function instance
The <?php//owner can read and write, others do not have any permissions chmod ("Test.txt", 0600);//The owner can read and write, the other person is readable chmod ("test.txt", 0644);//owner has all permissions, All other persons can read and execute chmod ("Test.txt", 0755);//owner has all permissions, the owner of the group is readable chmod ("test.txt", 0740); >