When I use chmod() to change permissions at run time, it gives me the below message:
chmod()
Warning: chmod() [function.chmod]: Operation not permitt
In order to perform chmod, you need to be owner of the file you are trying to modify, or the root user.