chmod() function
The chmod() function attempts to change permissions of the specified file. Returns TRUE on success or FALSE on failure. To ensure the expected operation, you need to prefix mode with a zero (0755 instead of 755).
<?php
//File Attributes: Read and write for owner, read for everybody else chmod ( "file.txt", 0644);
//File Attributes: Everything for owner, read and execute for everybody else chmod ( "file.txt", 0755); ?>