This can be done with a Configuration varaible in the apache httpd.conf file
Check http://www.php.net/manual/en/configuration.php
engine boolean
This directive is really only useful in the Apache module version of PHP. It is used by sites that would like to turn PHP parsing on and off on a per-directory or per-virtual server basis. By putting engine off in the appropriate places in the httpd.conf file, PHP can be enabled or disabled.
Also check here for the right place to put it
http://httpd.apache.org/docs-project/