I have been inspecting some PHP source codes and I more often than not find files starting with
defined(\'__someconstant__\') or exit();
I
Adding to @NullUserException's answer...
Yes there are other ways of preventing a file from being accessed directly (.htaccess being one), but for software that is shared with a wide audience, you can't really rely on those technologies being there. You can rely on a simple condition at the top of the files though.