PHP 8.3.4 Released!

Windows 上での PHP の手動インストール

ウェブサーバーの選択

IIS

IIS は Windows に標準で組み込まれています。 Windows サーバーの場合は、サーバーマネージャーを使って IIS ロールを追加します。CGI ロールを含める必要があります。 Windows デスクトップの場合は、コントロールパネルの「プログラムの追加と削除」を使って IIS を追加します。 Microsoft のドキュメントに » 詳細な手順があります。 デスクトップウェブアプリケーションやウェブ開発の場合は、IIS/Express や PHP Desktop も使えます。

例1 IIS と PHP の設定をするためのコマンドライン


@echo off

REM download .ZIP file of PHP build from http://windows.php.net/downloads/

REM path to directory you decompressed PHP .ZIP file into (no trailing \)
set phppath=c:\php


REM Clear current PHP handlers
%windir%\system32\inetsrv\appcmd clear config /section:system.webServer/fastCGI
REM The following command will generate an error message if PHP is not installed. This can be ignored.
%windir%\system32\inetsrv\appcmd set config /section:system.webServer/handlers /-[name='PHP_via_FastCGI']

REM Set up the PHP handler
%windir%\system32\inetsrv\appcmd set config /section:system.webServer/fastCGI /+[fullPath='%phppath%\php-cgi.exe']
%windir%\system32\inetsrv\appcmd set config /section:system.webServer/handlers /+[name='PHP_via_FastCGI',path='*.php',verb='*',modules='FastCgiModule',scriptProcessor='%phppath%\php-cgi.exe',resourceType='Unspecified']
%windir%\system32\inetsrv\appcmd set config /section:system.webServer/handlers /accessPolicy:Read,Script

REM Configure FastCGI Variables
%windir%\system32\inetsrv\appcmd set config -section:system.webServer/fastCgi /[fullPath='%phppath%\php-cgi.exe'].instanceMaxRequests:10000
%windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi /+"[fullPath='%phppath%\php-cgi.exe'].environmentVariables.[name='PHP_FCGI_MAX_REQUESTS',value='10000']"
%windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/fastCgi /+"[fullPath='%phppath%\php-cgi.exe'].environmentVariables.[name='PHPRC',value='%phppath%\php.ini']"

Apache

Windows 用の Apache2 のビルドには、いくつかの種類があります。 ApacheLounge がおすすめですが、それ以外にも XAMPP や WampServer や BitNami といったものがあり、これらはインストーラがついています。 Apache で PHP を使うには、mod_php あるいは mod_fastcgi を用います。 mod_php を使う場合は、スレッドセーフ版の Apache を使う必要があります。また、同じバージョンの Visual C、同じ CPU (x86 あるいは x64) のビルドでなければいけません。

ビルド方法の選択

Windows 向けのビルドは » http://windows.php.net/download/ からダウンロードできます。 全てのビルドは最適化(PGO) されており、 QA や GA リリースで数多くのテストがなされています。

PHP には四種類のビルドがあります。

  • Thread-Safe(TS) - Apache と mod_php のような、シングルプロセスのウェブサービス用

  • Non-Thread-Safe(NTS) - IIS やその他の FastCGI ウェブサーバー (Apache と mod_fastcgi など) 用。また、コマンドラインのスクリプト用にもおすすめ。

  • x86 - 32ビット版向け

  • x64 - 64ビット版向け

add a note

User Contributed Notes 1 note

up
-54
klaussantana at gmail dot com
3 years ago
If you're installing PHP 8.0.1 as Apache http server module, in httpd.conf you must use "php_module" in "LoadModule" directive instead of versioned names like in previous versions (aka, php5_module, php7_module, ...). Make the directive as follow:

LoadModule php_module "/path/to/php8apache2_4.dll"

I cracked my head over this...
To Top