Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kohana: Is it necessary to check if SYSPATH is defined?

Tags:

php

kohana

I'm a CodeIgniter user and I'm taking a look at Kohana. First thing I noticed is that in the documentation every snippet starts with:

<?php defined('SYSPATH') or die('No direct script access.');

assuming I'll be using .htaccess for address rewrite, is this really necessary? Is it an alternative to .htaccess for the purpouse of avoiding direct access? Is it just a good practice for "defense in depth"?

like image 261
Matteo Riva Avatar asked Feb 13 '10 17:02

Matteo Riva


1 Answers

If you are using a .htaccess file to protect your system files, this is not required. However, since kohana has to support non .htaccess use, we place that there in the core system files for some basic security.

like image 196
zombor Avatar answered Sep 27 '22 21:09

zombor