Php – Disable PHP on individual web site using PHP manager

iisPHP

I installed "PHP Manager" from http://php.iis.net/, which worked great. However, only one of the web sites on my machine uses PHP, and I'd like to disable it for the others. Is there a way that I can choose which sites get PHP and which don't?

Best Answer

if you can set php flags with php manager you can disable php like that:

php_admin_flag  engine 0

on apache you have the option to set php flags within the virtualhost or in the htaccess.

apache example:

<virtualhost host1...>
php_admin_flag  engine 1
php_value error_reporting 8191
php_flag apc.enabled 1
</virtualhost>

<virtualhost host2...>
php_admin_flag  engine 0
php_value error_reporting 8191
php_flag apc.enabled 0
</virtualhost>

with iis i have no direct experience but i found the following link: http://forums.iis.net/t/1150190.aspx

leading to: http://www.iis-aid.com/articles/how_to_guides/setting_per_directory_php_configuration_values

Last week I wrote about the different location in Windows where php.ini is loaded from. The values set in your php.ini configuration file are global and will be set for every PHP environment on your server. What happens though if you want to configure different PHP environment settings for each site on your server, or even different PHP settings for directories within a site? This can be done with the ini_set() function, but as not all of us are coders or have the time to work code modifications in there is another option; the registry, which is the method which we'll be looking at in this article.

Back in the PHP4 days there was no way in which to configure anything but global PHP directives when using IIS. These days with PHP5 this is possible by configuring the HKLM\SOFTWARE\PHP\Per Directory Values registry value which is a really quick and easy way to configure your PHP_INI_USER values. With this registry setting you are able to specify different PHP directives for any and all directories within your websites.

To do this simple create a key in your registry using regedit under HKLM\SOFTWARE\PHP\Per Directory Values using the structure of your directory path and then create a string value using the name of the PHP directive you wish to alter. For example, if you wish to set the memory_limit PHP directive to a value of 24M in a directory located in X:\path\to\php you'd do the following;

   Create a key with the path of HKLM\SOFTWARE\PHP\Per Directory Values\x\path\to\php
   Create a string value with the name memory_limit

   Set the string name value to 24M