IIS: different PHP configuration per site

In this article, I explain how to customize the PHP directives for each of the sites on an IIS server.

There are several more or less complex methods.

I will introduce the one that for me seems the least restrictive, the use of PATH sections in the configuration of PHP.

Configuration of the site in php.ini

Open the php.ini file that corresponds to the version of PHP running on the site and add at the end of the file a PATH section as below with the instructions to overload.

[PATH=D:/path/website1]
error_reporting = E_ALL & ~E_NOTICE
error_log = "D:\path\website1\logs\php72-error.log"
upload_max_filesize = 11M
max_file_uploads = 20

Conclusion

With this solution, it is possible to customize PHP settings for each site.

In case of PHP version change, think about putting the lines in the correct php.ini file