How can I make php and py in a certain directory display as text?
I am working on a file hosting program, but I need to make php files either download, or display as text.
I haven't been able to find any information on this.
How can I make php and py in a certain directory display as text?
I am working on a file hosting program, but I need to make php files either download, or display as text.
I haven't been able to find any information on this.
It depend on HTTP server software that you used (nginx, apache, etc)
example for nginx config, just remove block that handle php interpreter:
# remove this lines until end block
--> location ~ [^/]\.php(/|$) {
--> ... Other code
--> }
All php files will displayed as text, if you still need to execute php file on index.php, then you need edit it instead of delete all block, like this:
location = /index.php {
... Other code
}
example for apache server, put on .htaccess file on directory (refer from this answer):
php_flag engine off
#This will prevent apache from executing *.php-files
AddType text/plain php
#this wil display php-files in browser (if not, browser will want to download file!)