Windows 上的 php (IIS, APACHE)

 

 


Download

https://windows.php.net/download/

vcredist

  • VS16
  • VC10
  • VC9 (Visual Studio 2008)
  • VC8
  • VC6 (Visual Studio 6)

Non Thread Safe vs Thread Safe

Package

  • php-8.3.1-nts-Win32-vs16-x64.zip
  • php-8.3.1-Win32-vs16-x64.zip

簡單選擇: IIS 就選擇 Non Thread Safe; Apache 就選擇Thread Safe

 


IIS

在 IIS 上行 php 的方式

  • ISAPI(DLL)[Thread Safe]
  • FastCGI[ CGI binary]

If you are using PHP with Apache 1 or Apache2 from apache.org you need to use the VC6 versions of PHP

If you are using PHP with IIS you should use the VC9 versions of PHP

VC9 versions require you to have the Microsoft 2008 C++ Runtime

Do NOT use VC9 version with apache.org binaries

Setup

IIS 7.5

在 Server(樹頂) 的 Handler Mappings 建立 PHP_via_FastCGI

  • Request path: *.php
  • Module: FastCgiModule
  • Executable: "C:\PHP\php-cgi.exe"
  • Name: PHP via FastCGI

 * If you do not see "FastCgiModule" in the "Modules:" drop-down list then it means that the module is not registered or not enabled.

CGI-Settings

GUI: IIS > Server > "FastCGI Settings" > YOUR_APP

instanceMaxRequests (Default: 200)

For PHP, this number must be lesser or equal to the maximum number of requests for PHP environment,
 which is configured by using the "PHP_FCGI_MAX_REQUESTS" environment variable.

activityTimeout (Default: 30)

If a FastCGI process does not send any data on the stdout or stderr stream
 for the duration specified by ActivityTimeout, IIS terminates the process.

This setting essentially helps to prevent a slow or
 non-responsive FastCGI process from holding up resources indefinitely.

requestTimeout (Default: 90)

This is the total time a FastCGI request can take,
 from the time the request is received until the time the response is sent back to the client.

This setting helps to ensure that a single request does not consume too much of the server's time.

idleTimeout (Default: 300)

a FastCGI process can be idle before the process is shutdown

maxInstances (Default: 0)

The maximum number of FastCGI worker processes that can be started in an application pool.

 


Apache

 

http://www.apachelounge.com/

php.ini settings

[PHP_DBASE]
extension=php_dbase.dll

LoadModule php5_module "c:/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
# configure the path to php.ini
PHPIniDir "C:/php"

 

 

Creative Commons license icon Creative Commons license icon