I have just spent a tiresome morning trying to get PHP 5.2 / 5.3 installed onto Apache 2.2 (WinXPSP2) (Slight oddity in setup that program files on D: drive)
I have finally got it to work by using the following:
1) Getting installation script to use "Other CGI" (would be nice if it mentioned Apache - I believe it to be a fairly popular option)
2) Adding the following directives to httpd.conf (the Apache configuration file)
ScriptAlias /php/ "D:/Program Files/PHP/"
(This tells Apache to treat the PHP directory as script files/executables and alias it under /php/ for ease of use later)
AddHandler x-httpd-php .php
(This tells apache to recognise all .php files as of type x-httpd-php (equally you could call them anything you liked and after this mornings debacle I can think of one or two choice phrases)
Action x-httpd-php "php/php-cgi.exe"
(The tells Apache to use php-cgi.exe to handle files of type x-httpd-php (or .php files as we declared earlier). php-cgi.exe only exists if you have selected the "Other CGI" option at installation". A lot of stuff around on the web is pointing at php.exe which is now failing. Has this changed recently?)
Windows インストーラ (PHP 5.2 以降)
Windows 用 PHP インストーラの最新版は、MSI 形式になっています。これは Wix Toolkit (» http://wix.sourceforge.net/) で作成されています。 このインストーラは、インストールおよび PHP の設定、そして組み込みのモジュールと PECL 拡張モジュールの設定だけでなく、 IIS、Apache そして Xitami などといった多くのウェブサーバの設定も行います。
最初に、お好みの HTTP (ウェブ) サーバをシステムにインストールし、動作確認をします。 それから、次のうちのいずれかのインストール形式を選択します。
通常のインストール
MSI インストーラを実行し、インストールウィザードの指示に従います。 まず最初に設定するウェブサーバを選択し、 それに伴って必要となる設定を行います。
次に、さまざまな機能や拡張モジュールの中から インストールして有効にしたいものを選択します。 各項目のドロップダウンメニューで "Will be installed on local hard drive" を選択することで、その機能をインストールするかどうかを切り替えます。 "Entire feature will be installed on local hard drive" を選択すると、 その機能に関連するすべての機能がインストールされます (たとえば "PDO" に対してこのオプションを選択すると、 すべての PDO ドライバがインストールされます)。
すべての項目をデフォルトでインストールしてしまうのはお勧めしません。 それらの多くは、適切に動作させるためには PHP 以外の外部の依存性を解決する必要があるからです。 その代わりに、いったんインストールした後で コントロールパネルの「プログラムの追加と削除」 で修復モードを使用して拡張モジュールを有効にするようにしましょう。
次に、インストーラは Windows で使用する PHP と php.ini ファイルを設定し、ウェブサーバで PHP を使用できるように設定します。 現在インストーラがサポートしているのは IIS、 Apache、Xitami および Sambar Server のみです。 それ以外のウェブサーバを使用する場合は、自分で設定する必要があります。
サイレントインストール
このインストーラはサイレンとモードもサポートしています。 このモードは、システム管理者が簡単に PHP 環境を構築する際に便利です。 サイレントモードは、次のようにして使用します。
msiexec.exe /i php-VERSION-win32-install.msi /q
インストール先ディレクトリを設定するには、インストール時のパラメータとして指定します。 例えば、e:\php にインストールする場合は次のようになります。
msiexec.exe /i php-VERSION-win32-install.msi /q INSTALLDIR=e:\php
また、インストールする機能を指定することもできます。例えば、 mysqli 拡張モジュールおよび CGI 実行ファイルをインストールするには次のようにします。
msiexec.exe /i php-VERSION-win32-install.msi /q ADDLOCAL=cgi,ext_php_mysqli
現在、インストールする機能としてサポートされている項目は次のとおりです。
MainExecutable - php.exe 実行ファイル (PHP 5.2.10/5.3.0 以降は存在しません。デフォルトで含まれるようになりました) ScriptExecutable - php-win.exe 実行ファイル ext_php_* - 各種拡張モジュール (例: MySQL の場合は ext_php_mysql) apache13 - Apache 1.3 モジュール apache20 - Apache 2.0 モジュール apache22 - Apache 2,2 モジュール apacheCGI - Apache CGI 実行ファイル iis4ISAPI - IIS ISAPI モジュール iis4CGI - IIS CGI 実行ファイル iis4FastCGI - IIS CGI 実行ファイル NSAPI - Sun/iPlanet/Netscape サーバモジュール netserve - NetServe Web Server CGI 実行ファイル Xitami - Xitami CGI 実行ファイル Sambar - Sambar Server ISAPI モジュール CGI - php-cgi.exe 実行ファイル PEAR - PEAR インストーラ Manual - CHM 形式の PHP マニュアル
MSI インストーラをコマンドラインから使用する方法の詳細については » http://msdn.microsoft.com/en-us/library/aa367988.aspx を参照ください。
インストーラによる PHP のアップグレード
アップグレードの際も、ダブルクリックあるいはコマンドラインから通常どおりインストーラを実行します。 インストーラが現在のインストールオプションを読み取り、 現在インストールされているバージョンを削除してから 同じオプションで PHP をインストールしなおします。 インストールディレクトリのファイルを手動で置き換えるのではなく、 この方法で PHP をアップグレードすることを推奨します。
Windows インストーラ (PHP 5.2 以降)
21-Jul-2009 01:50
19-May-2009 10:41
Looks like IIS ISAPI option is missing from php-5.2.9-2-win32-installer.msi
12-Feb-2009 09:41
Using the installer, I have been getting the "cannot run script" error on Windows XP and IIS 5.1. I used both the Zip file and installer filer to make it successful:
1. I downloaded the zip file (not the installer) into C:\php\,
2. extracted the contents to the same directory (C:\php\).
3. Downloaded and ran the installer into the C:\php\
Nagesh A
09-Jan-2009 03:06
I just installed PHP 5.2.8 (MSI package) on windows XP, IIS 5.1.
Selected IIS-ISAPI, always got error "The specified module could not be found." (firefox), HTTP 500 Internal Server Error (ie 7). Even though no extensions were selected.
Trick: Install PHP to C:\PHP (and not to C:\Program Files\PHP)
In your IIS web site properties, tab home directory, configuration, application mappings.
Remove the quotes before and after the executable path and the problem will be solved.
30-Dec-2008 10:33
I just installed PHP 5.2.8 as an ISAPI-extension for IIS 6 in Windows 2003 server.
I used the Windows installer, but had to make a few changes manually:
- Copy php.ini from the PHP folder (C:\Program Files\PHP) to the Windows folder (C:\Windows).
- Enable the ISAPI extension. (In IIS Manager under "Web Service Extensions" add a new extension with "Required files" set to C:\Program Files\PHP\php5isapi.dll).
- Add index.php to default index pages (select properties for "Web Sites", add it on the "Documents" tab).
