Is there a way to stop php files from working if the php processor is disabled?

What question did my partner say that I do not need to answer, so in order to prove my point, I removed php and simulated a problem with the server. And above all, the web server serves the PHP source code as a download.

So, the question is, is there a way to stop the source flow in case of a server failure, error or temporary loss of connection with the corresponding modules, etc.

+6
php
source share
3 answers

The only way to detect the source is to change the server configuration by mistake - for example, you use mod_php for Apache and accidentally delete the module.

In this particular case, you can do this:

<IfModule php5_module> AddHandler php5-script .php PHPIniDir "/etc" </IfModule> <IfModule !php5_module> <FilesMatch "\.php$"> Order allow,deny Deny from all Satisfy All </FilesMatch> </IfModule> 
+3
source share

Place the PHP files outside the document root, then require them from the PHP files inside the document root. They will still get some code like this or something else, but that will not give them so many details:

 require(dirname(dirname(__FILE__))."/real_file.php"); 
+2
source share

I wrote a couple of simple functions to parse MVC URLs (based on kissmvc.com), and this is the only php in my document root:

 <?php require '../bootstrap.php'; parse_request(); 

So, if something happened, it will see everything. Everything else is handled starting with bootstrap. If I wanted, I could move parse_request () to bootstrap.php, but I did it in such a way that I could include my boot file and not send all the website materials if I only clicked the cron script (and this was before I understood about the php_sapi_name () function and constant).

It is not profitable if you have an existing site with php in docroot or are using Wordpress, etc., but if you have this option, this will not allow this particular problem to kick you from boys.

0
source share

All Articles