Running SuPHP and mod_php side by side

Recently I had the need to setup a server running both mod_php (for speed) and SuPHP for security. Here is how it’s done.

LoadModule suphp_module        modules/mod_suphp.so
LoadModule php4_module         modules/libphp4.so
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
AddHandler x-httpd-php .php
suPHP_Engine on
php_admin_flag engine off
  

Putting the above into your config will default to php pages being run by suPHP. To switch a virtual host over to mod_php, use the following.

<VirtualHost ..>
  suPHP_Engine off
  RemoveHandler .php
  php_admin_flag engine on
  ...