As long as I’m messing with apache configs, I’ll share another quick tip. If you have PHP generally enabled in apache, but you want to disable it in a certain VirtualHost, just add the line “php_admin_value engine off” and you’ll be all good. PHP will work elsewhere, but it will be off inside your described virtualhost. For example:
<VirtualHost *:80> ServerName www.foobar.com php_admin_value engine off DocumentRoot /var/www/foobar </VirtualHost>
as a note (albeit an important one), using “php_admin_value” rather than “php_value” keeps the directive from being overridden in .htaccess files.
whammy.
{ 2 comments… read them below or add one }
Thanks!
Thanks. If you want to cause the PHP files to be served as html (which might or might not be a good idea, but in some situations you want to) you can add the directive
AddType text/html .php
to the VirtualHost container.