phpsecurityexecutionsuphp

How can I prevent php execution in parts of a website?


I have a LAMP server running php as suphp, with several websites. If I'm not mistaken, php code can normally be prevented from running in a certain part of a website by putting "php_flag engine off" in a .htaccess file located in the corresponding directory, alternatively put "php_flag engine off" in the VirtualHost directive in Apache. But this apparantly is only valid for regular mod_php and not suphp. So how can I achieve the same thing in suphp?

For example, I want to disable PHP code inside the www.foo.com/images/ but allow it anywhere else on that site.

I have searched here on stackoverflow but only found solutions for mod_php.


Solution

  • Add the following into .htaccess

    RemoveHandler .php
    RemoveType .php
    

    in the folder which you need to disable PHP for