[UPHPU] recursively set directories and files different permissions

Richard K Miller richardkmiller at gmail.com
Wed Jan 9 19:20:04 MST 2008


On Jan 9, 2008, at 6:54 PM, Wade Preston Shearer wrote:

>> My understanding is that the default permissions for directories  
>> are 0755 and for files 0644, which turns on execution for  
>> directories but not files. If you need to change the defaults, you  
>> use the umask:
>
> Thanks. Yes, that makes sense now (with past experience and the  
> tests I have been running). Being reminded of that, I went and ran  
> some more tests and it turns out that there is something else that  
> confuses me. None of the files (even the ones that I want to be  
> executable) are executable. I thought that a script file (such as  
> one containing PHP code) had to be executable in order to be served  
> up. Does the executable permission only apply to executing things  
> from the command line and not what Apache can and cannot serve?

If it's Apache + mod_php, execute permissions are not required. (If  
it's Apache + CGI PHP, they are.)

The command line can go both ways too:

This requires execute permission and the file must begin with an  
appropriate hash-bang such as #!/usr/bin/php :
$ ./myphpfile.php

This does not require execute permission:
$ /usr/bin/php myphpfile.php




More information about the UPHPU mailing list