
Originally Posted by
misson
Every file with a PHP extension will be passed through the first registered handler before being sent to the client. This means that there's no way for a visitor to view a .php file by accessing it directly when PHP is registered as the handler for .php files. If PHP isn't registered, then PHP scripts aren't working, which is a more immediate concern that security. The only other way a visitor can access the source is indirectly, which would require another script (not necessarily PHP) that opens files and sends their contents to the visitor. If you don't have such a script, then you're safe.
Permissions will be of limited utility in preventing reading the source of a script. As stated above, the server won't send the source on its own, so the only read access you need to prevent is from users on the same server. The server needs read access to the script; if the server doesn't run under your credentials, any permissions that let the server read the script will let another user read the script (as they can write a script that will be run by the web server using the server's credentials).
Edit: I just set a PHP script to mode 0600 and it still worked. It looks like the server runs under your account, so removing read access from all but the file owner will prevent other local users from reading the file while still allowing the server to access it.