Security: blocking direct access of php files

In my opinion, the only way to do this (within the context of WordPress) is:

if ( ! defined( 'ABSPATH' ) ) // Or some other WordPress constant
     exit;

The second technique is vague and does give the same level of checking (it only checks that the filename of the main PHP file matches itself, not whether WordPress is loaded, nor if it’s another file of the same name).

And this No script kiddies please! is pointless, I wish this fad would die – just exit silently.

tech