Ok, so I'm not really sure about the permissions when it comes to php, or any other language that is execution on the server side.
From what I know, a file has the following permissions: read, write, execute, they can be combined, like read and execute only, write only, and so on and so forth. There are three "types of users", so basically, read, write, execute permissions need to be set for each of them: users, that are: root, group, world. If I set the read permissions to "ON" for each one, theoretically, I should be able to download the php file, whoever I am, because all the users can read the file.
Did a little experiment on my local server. I have a file called a.php which contains the following code:
<?php
echo 'executed';
?>
I've set it's permissions to 333 which is -r--r--r--. Everybody that's accessing the file, can only read it. If I go to a.php using my browser, I just see executed which is the result of the echo from the php file, not the entire text. I am not really sure why this is happening, and not showing all the code. This is a really good thing in a way, because hackers won't be able to see the source code, even if you forget to disable the read permissions for example.
It's a mistery for me atm, if somebody could explain why this is happening, would really appreciate it. Thanks!