Joomla: defined('_JEXEC') or die;

The following line is found at the start of Joomla PHP files.

defined('_JEXEC') or die;

_JEXEC is a constant that is defined in the index.php file at the root of the Joomla as follows:

define('_JEXEC', 1);

This is used to mark a secure entry point into Joomla. The defined or die check makes sure that _JEXEC has been defined in the pathway to get to the file. It also prevents accidental injection of variables through a register globals attack that trick the PHP file into thinking it is inside the application when it really isn't.

If someone tries to run a PHP file directly, outside the application, the '_JEXEC' constant won’t be defined and the file will not be executed. If you include a PHP file in the application that does not have the defined line at the start, someone could enter the path to the file directly in the browser.