Disabling PHP in a specific directory

To disable the PHP processor in a given directory, put the following in an .htaccess file. If one doesn’t exist, create it.

# Disable PHP
AddHandler default-handler php
RemoveType application/x-httpd-php php

# Make .php files display as plain text
AddType text/plain php

This assumes an Apache server. PHP on IIS may involve different steps.

Files starting with a . are hidden by default on *nix OSes. To see them in listings, use ls -a.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.