What are the best practices for setting up PHP on IIS for optimal performance?

To optimize PHP performance on IIS, it is recommended to use the FastCGI module, enable caching, and configure PHP settings such as memory_limit, max_execution_time, and realpath_cache_size appropriately. Additionally, utilizing opcode caching with a tool like OPcache can significantly improve performance by storing precompiled script bytecode in memory.

; Enable FastCGI module
cgi.force_redirect = 0

; Enable caching
realpath_cache_size = 4096k
realpath_cache_ttl = 600

; Configure PHP settings
memory_limit = 256M
max_execution_time = 30

; Enable OPcache
zend_extension=php_opcache.dll
opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60