Home > Article > Backend Development > fleaphp FleaPHP security settings method
Prerequisites:
Virtual machine, the fleaphp folder cannot be placed in a path that is inaccessible to http, and the configuration files of apache and php cannot be modified.
fleaphp uses default configuration
Method:
1. Place the controller folder outside the root directory (this method is only suitable if you have a server)
2. In the controller file, try not to explicitly output such as echo print, etc.
3. To hide the controller directory, take a folder with a password similar to sdfsdf12312SDCVd/Flea
4. Change the directory name of the default CMT through the configuration file
5. Place an .htaccess under the root directory to prohibit access to certain directories (only suitable for apache Server)
6 When no configuration file can be modified, except index.php, all MVC layer files must be preceded by
defined('APP_DIR') or header("HTTP/1.0 404 Not Found"); and It is best to change 'APP_DIR' to a name that is difficult to guess. 7. Placing an empty index.htm file in the directory is also one of the ways to prevent directory leakage.
8.
function FLEA_Exception($message = null, $code = 0)
{
$this->message = $message;
$this->code = $code;
$this->trac = debug_backtrace ();
// Get the file and code line number where the exception was thrown
$last = array_shift($this->trac);
$this->file = $last['file'];
$this- >line = $last['line'];
}
This is the constructor of FLEA's exception handling class FLEA_Exception. My personal idea can be changed when the program hangs
// Get the file and code that throws the exception Line number
$last = array_shift($this->trac);
$this->file = $last['file'];
$this->line = $last['line'];
this part
The above introduces the security setting method of fleaphp, including fleaphp content. I hope it will be helpful to friends who are interested in PHP tutorials.