Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable PHP script for one directory? 2

Status
Not open for further replies.

iranor

Programmer
Jun 17, 2004
174
CA
I want to give some users a FTP directory. I just want to know if it's possible to disable PHP scripting in this directory.

The FTP account is only to be used to upload images & videos. Is there a way to use a .htaccess or anything else to prevent php to parse the files in a specific directory?
 
Yes, there's actually two ways you can do it, one is to actually *turn off* php, the other is to simply deny access to files that would be processed as php. Both these methods are using .htaccess files.
1) Contents of .htaccess (This will turn off processing of php files, whilst still allowing their contents to be viewed):
php_value engine off
AddType text/plain .php .phtml .php3 .html .htm .shtml

2) Contents of .htaccess (This actually will turn off most common "script" type of files and prevent them from being accessed via the webserver):
<Files ~ "\.(php|php3|php4|phps|phtml|shtm|shtml|cgi|pl|pm|asp|aspx|cfm|cfml|js|vbs|jse|jsp|jar|py|do|exe|com|bat|dll|pif|scr|reg|inf|htaccess)$">
order allow,deny
deny from all
</Files>

---------
HTH,
Gavin Ostlund
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top