Answer the question
In order to leave comments, you need to log in
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
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.
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.
On Apache, you can set this:
<IfModule !php5_module>
<FilesMatch "\.php$">
Order allow,deny
Deny from all
</FilesMatch>
</IfModule>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question