Y
Y
Yuri Denisov2017-11-07 07:58:49
PHP
Yuri Denisov, 2017-11-07 07:58:49

How to stop downloading a PHP file?

Good day to all!
At one point, several users apparently fell off apache, which is why, instead of working out, the PHP script was simply given to the user for download. The question arose of how to prevent the server from giving a PHP file for download in such situations. Roughly speaking, regardless of what happens on the server, do not allow PHP to be downloaded, but so that they work out at normal times. :) On the server, Apache is used as a handler, Nginx is used as a proxy for returning statics. Also interested in the answer if only Apache is installed

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
ky0, 2017-11-07
@denissov

Set the owner of the php files to a user that is different from the one under which the web server is launched. Then remove read permission for everyone (for example, chmod 711), leaving only execute.

L
Lander, 2017-11-07
@usdglander

If only Apache is installed, then in case of its fall, no one will listen to the 80th port! Accordingly, it will not be possible to access the file system from the browser.

A
Andrey Stepanov, 2017-11-07
@leoykt

On Apache, you can set this:

<IfModule !php5_module> 
    <FilesMatch "\.php$">        
        Order allow,deny
        Deny from all     
    </FilesMatch>
</IfModule>

When the module crashes, so that the return of PHP in its pure form does not work.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question