PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

構築時の問題> <データベースに関する問題
Last updated: Fri, 05 Sep 2008

view this page in

インストール

このセクションでは PHP のインストール方法に関する一般的な質問を扱います。 PHP は(OSX 以前の MacOS を除けば)、ほとんど全ての OS とウェブサーバで 利用可能です。

PHP をインストールするには、インストールと設定 の指示に従ってください。

    なぜ、Apache 2 のマルチスレッド MPM モードを実運用環境で使用するべきではないのですか?

    PHP はグルー(糊)です。このグルーは、多くのサードパーティ製のライブラリを くっつけることによりクールな Web アプリケーションを構築するために使用され、 直観的で簡単に習得できる言語インターフェイスにより、一つの整合性のある実体として 見せることができます。 PHP の柔軟性と力は、プラットフォームの安定性と堅牢性に基づいています。 グルーによる結合をするためには、OS や Web サーバ、サードパーティ製のライブラリを 必要とします。 これらの一つの機能が停止した場合、PHP は問題を特定し、速やかに修正する 手段を必要とします。 実行スレッドを完全に分離しなかったり、 メモリセグメントを完全に分離しなかったり、 各リクエストで使用される強力なサンドボックスを有さないことで、 基本的なフレームワークをより複雑なものにした場合、 PHP のシステムに弱点が生まれます。

    マルチスレッド MPM を使用する必要がある場合、 PHP が自分のメモリ空間で実行される FastCGI 設定を観てみてください。

    最後に、この警告はマルチスレッド MPM の使用に対するものですが、 Windows システムではより多くのライブラリがスレッドセーフである傾向が あるため、この警告の度合はより弱くなります。

    Unix/Windows: php.ini ファイルはどこに置けばよいのですか?

    UNIX の場合、デフォルトでは /usr/local/lib です。コンパイル時に --with-config-file-path オプションを使用してこの場所を変えたいという人も多いでしょう。 例えばこのようにすることも出来ます:

    --with-config-file-path=/etc
          
    そしてディストリビューションの php.ini-dist/etc/php.ini にコピーし、環境に合うように 編集してください。

    --with-config-file-scan-dir=PATH 
         

    Windows の場合、php.ini のデフォルトパスは Windows ディレクトリになります。 Apache ウェブサーバを使っている場合はまず Apache がインストールされているディレクトリ (例えば c:\program files\apache group\apache にある php.ini を探そうとします。このため、異なる php.ini ファイルを異なるバージョンの Apache ごとに置いておくことができます。

    設定ファイルの章も参照してください。

    Unix: PHP をインストールしましたが、ファイルをロードするたびに 'Document Contains No Data(ページが表示できません)' という メッセージが表示されます。何が起こっているのですか?

    これはおそらく PHP に何らかの問題が起こっていてコアダンプしている という状態です。サーバのエラーログを見てこのケースかどうかチェック してください。そして小さなテストケースで問題を再現させてみてください。 もし 'gdb' の使い方が分かるならバグレポートに加えてバックトレースを 提供してもらえると開発者が問題の箇所を突き止めるのに 非常に役立ちます。もしあなたがPHPをApacheモジュールとして使用している 場合は以下のようにします:

    • httpd を停止します

    • gdb httpd

    • Stop your httpd processes

    • > run -X -f /path/to/httpd.conf

    • ブラウザから問題のある URL にアクセスします

    • > run -X -f /path/to/httpd.conf

    • もしコアダンプが発生すると gdb が知らせてくれます

    • bt とタイプします

    • このバックトレースをバグレポートに含めてください。バグレポートは » http://bugs.php.net/ から送信してください。

    もしそのスクリプトが正規表現関数を使用している場合 (ereg()やその類似関数)、PHP と Apache が同じ正規表現の パッケージを使用してコンパイルされているかどうかを確認してください。 PHP と Apache 1.3.x を使用している場合は常に確認が必要です。

    Unix: RPM を使って PHP をインストールしたのですが、Apache が PHP のページを 処理してくれません。何が起こっているのですか?

    あなたが Apache と PHP の両方を RPM でインストールしたとすると、以下に示す 内容の一部もしくは全てを httpd.conf ファイルに追加するか、コメントを 外す必要があります:

    # Extra Modules
    AddModule mod_php.c
    AddModule mod_php.c
    AddModule mod_perl.c
    
    # Extra Modules
    LoadModule php_module         modules/mod_php.so
    LoadModule php5_module        modules/libphp5.so     # for PHP 5
    LoadModule perl_module        modules/libperl.so
    
    そして以下の行:
    AddType application/x-httpd-php .php
    
    以上の内容を全体設定、もしくは PHP サポートを追加したいバーチャル ドメインの設定に加えてください。

    Unix: Apache に FrontPage エクステンションのパッチを当てたら、突然 PHP が動作しなくなってしまいました。PHP は Apache の FrontPage エクステンションと共存することはできないのですか?

    いいえ。PHP は FrontPage エクステンションと問題なく共存できます。 問題は FrontPage エクステンションのパッチが PHP が依存している Apache の 構造の一部を変更してしまうことにあります。パッチを当てた後で PHP を再コンパイル('make clean; make' としてください)すれば問題は 解決されます。

    Unix/Windows: PHP をインストールしたのですがブラウザから PHP スクリプトにアクセスしても何も表示されません。

    ブラウザの「ソースの表示」を実行してください。おそらく PHP の ソースコードが表示されると思います。これはウェブサーバがスクリプトを PHP に渡していないためスクリプトが実行されていない、ということを 意味します。サーバ側の設定のどこかが間違っているはずですので、 PHP インストールマニュアルに従って再度入念に設定を確認してみてください。

    Unix/Windows: PHP をインストールしたのですがブラウザから PHP スクリプトにアクセスすると Internal Server Error 500 となってしまいます。

    ウェブサーバが PHP を実行するときに何らかの問題が起きています。 どんなエラーが起こっているか確認するために、コマンドラインで PHP 実行ファイル(Windows では php.exe) のある ディレクトリに移動して php -i を実行してください。 もし PHP の実行時に問題があった場合は適切なエラーメッセージが表示されるので、 それを手がかりに次に何をすべきかを知ることができます。画面 一杯に HTML(phpinfo() 関数の出力)が表示された場合には PHP は問題なく動作していますので、問題はウェブサーバの設定 にあるはずです。再度入念にチェックしてみてください。

    PHP をインストールするまではエラーもなく問題なく進んだのですが、 apache を起動させようとすると undefined symbol エラーが発生します。

    [mybox:user /src/php4] root# apachectl configtest
     apachectl: /usr/local/apache/bin/httpd Undefined symbols:
      _compress
      _uncompress
          

    これは、PHP とは関係なく MySQL クライアントライブラリの問題です。 このライブラリのうちある種のものは --with-zlib を必要とし、 他のものは必要としません。この問題は MySQL FAQ でも扱われています。

    Windows: PHP をインストールしたのですがブラウザから PHP スクリプト にアクセスすると次のようなエラーが出力されます。

    cgi error:
     The specified CGI application misbehaved by not
     returning a complete set of HTTP headers.
     The headers it did return are:
          

    このエラーメッセージは PHP が(何らかの理由で)何も出力できなかった ことを意味します。詳細なエラーメッセージを得るためには、 コマンドラインから PHP 実行ファイル(Windows では php.exe)のあるディレクトリに移動して php -i を実行してください。もし PHP の実行時に問題 があった場合は適切なエラーメッセージが表示されるのでそれを 手がかりに次に何をすべきかを知ることができます。画面一杯に HTML (phpinfo()関数の出力) が表示された場合には PHP は問題なく動作しています。

    PHP がコマンドラインで動作したなら、再度ブラウザから PHP スクリプトに アクセスしてみてください。もしまだ失敗するようなら以下のいずれかの 理由によるものと思われます。

    • PHP スクリプト、 php.exephp4ts.dllphp.ini もしくはロードしようとしている PHP 拡張モジュールの ファイルパーミッションが匿名インターネットユーザ IUSER_<machinename> にアクセスできない ものになっている。
    • スクリプトが存在しない(もしくはあなたが在ると思っている場所と ウェブサーバのルートディレクトリからの相対位置がずれている)。 IIS を使用している場合は、Internet Service Manager でスクリプト マッピングを設定するときに「ファイルの存在を確認する」にチェックを することでこのエラーをトラップすることができます。もしスクリプト ファイルが存在しない場合はサーバが代わりに 404 エラーを返すように なります。これにはもう一つ利点があります。それは IIS が スクリプトファイルの NTLanMan パーミッションに応じて認証を要求する ようになる、ということです。

    Windows: 全ての説明に従っているのに PHP が IIS で動作しません!

    PHP スクリプトを実行しようとするあらゆるユーザが php.exe の実行権限を必要としているということを 忘れないでください。IIS はインストール時に追加された匿名ユーザを使用 します。このユーザに対して php.exe の実行権限が 必要です。また、認証された全てのユーザに関しても php.exe の実行権限が必要です。IIS4 の場合はさらに PHP がスクリプトエンジンであるということを教えてやる必要があります。 この FAQ も読んでください。

    IIS, PWS, OmniHTTPD, Xitami上でCGIとしてPHPを実行するとき、 次のようなエラーが出る:Security Alert! PHP CGI cannot be accessed directly.

    cgi.force_redirect0 をセットしてください。デフォルトでは 1 にセットされていますので、そのディレクティブが ; でコメントアウトされていないことを確認してください。 他のディレクティブと同様にこれは php.ini 上でセットされます。

    デフォルトは 1 なので、100% 正しく php.ini ファイルが 読み込まれているかどうかが重要です。 詳細はこの FAQ を 読んでください。

    php.ini が認識され読み込まれていることをどうやって知ることが できますか? 自分の行った変更が反映されてないらしいのですが。

    php.ini とそれが PHP に読み込まれているかを確認するには phpinfo() をコールして最初のほうに 表示されている Configuration File (php.ini) を見てください。これは PHP が認識している php.ini と、それが 読み込まれているか否かを示しています。ディレクトリパスだけが 表示されている場合は、読み込まれていないということなので、 そのディレクトリに php.ini を置いてください。 php.ini が PATH にある場合それが読み込まれます。

    php.ini が読み込まれていてかつ PHP をモジュールとして実行 している場合、php.ini を変更した後で必ず Web サーバを 再起動してください。

    php_ini_loaded_file() も参照ください。

    Windows で PHP のディレクトリを PATH に追加するにはどうすればいいのですか?

    Windows NT、2000、XP および 2003 では、

    • コントロールパネルのシステムアイコンを選択します(スタート -> 設定 -> コントロールパネル -> システム、あるいは Windows XP/2003 では 単に スタート -> コントロールパネル -> システム)。

    • 詳細設定タブに移動します。

    • 「環境変数」ボタンを押します。

    • 「システム環境変数」欄を見ます。

    • Path というエントリを見つけます(スクロールする必要があるかもしれません)。

    • Path のエントリをダブルクリックします。

    • その最後に ';' と追加し、その後に PHP のディレクトリを追加します (例: ;C:\php)。

    • OK を押し、コンピュータを再起動します。

    Windows 98/Me では、autoexec.bat を編集する必要があります。

    • メモ帳を開きます(スタート -> ファイル名を指定して実行 で、 notepad と入力します)。

    • C:\autoexec.bat ファイルを開きます。

    • PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;..... という行を探し、 その行の最後に ;C:\php を追加します。

    • ファイルを保存し、コンピュータを再起動します。

    注意: 上の作業を行った後は、必ずコンピュータを再起動し、 PATH の変更が適用されていることを確認しましょう。

    PHP マニュアルでは、これまでファイルを Windows のシステムディレクトリに コピーするよう推奨してきました。なぜなら、このディレクトリ (C:\WindowsC:\WINNT、など) にはデフォルトでシステムの PATH が通っていたからです。ファイルを Windows のシステムディレクトリにコピーすることはずいぶん昔に非推奨と なっており、これはさまざまな問題のもととなりえます。

    Windows 上の PHP で、php.ini を使えるようにするにはどうしたらいいのですか?

    いくつかの方法があります。Apache を使用しているのなら、Apache 固有のインストール手順(Apache 1Apache 2)を参照ください。 それ以外の場合は、環境変数 PHPRC を指定する 必要があります。

    Windows NT、2000、XP および 2003 では、

    • コントロールパネルのシステムアイコンを選択します(スタート -> 設定 -> コントロールパネル -> システム、あるいは Windows XP/2003 では 単に スタート -> コントロールパネル -> システム)。

    • 詳細設定タブに移動します。

    • 「環境変数」ボタンを押します。

    • 「システム環境変数」欄を見ます。

    • 「新規」ボタンを押し、変数名に 'PHPRC' 、変数値に php.ini の 存在するディレクトリ(例: C:\php)を入力します。

    • OK を押し、コンピュータを再起動します。

    Windows 98/Me では、autoexec.bat を編集する必要があります。

    • メモ帳を開きます(スタート -> ファイル名を指定して実行 で、 notepad と入力します)。

    • C:\autoexec.bat ファイルを開きます。

    • ファイルの最後に以下の内容の行を追加します。set PHPRC=C:\phpC:\php を、実際に php.ini が存在するディレクトリに置き換えます)。パスには空白文字を 含められないことに注意しましょう。たとえば、もし PHP を C:\Program Files\PHP にインストールしたのなら、 その代わりに C:\PROGRA~1\PHP と入力する必要が あります。

    • ファイルを保存し、コンピュータを再起動します。

    Apache のコンテントネゴシエーション(MultiViews オプション)を PHP で使用することはできますか?

    もしリンクする PHP ファイルが拡張子を持っているなら、すべては うまく動作します。この FAQ が対象としているのは、リンクする PHP ファイルが拡張子を持っておらず、拡張子のない URL から PHP ファイルを判別するためにコンテントネゴシエーションを使用する方法です。 この場合、AddType application/x-httpd-php .php という行を以下のように変更します。

    # PHP 4
    AddHandler php-script php
    AddType text/html php
    
    # PHP 5
    AddHandler php5-script php
    AddType text/html php
    
    この方法は、Apache 1 ではうまく動作しません。なぜなら PHP モジュールが php-script をキャッチできないからです。

    PHP が処理できるリクエストメソッドは GET および POST だけなのですか?

    いいえ、それ以外のいかなるメソッド(例: CONNECT)でも扱えます。 適切な応答ステータスは、header() を使用して送信可能です。 GET および POST だけを処理したいなら、Apache の設定を以下のようにします。

    <LimitExcept GET POST>
    Deny from all
    </LimitExcept>
    



    構築時の問題> <データベースに関する問題
    Last updated: Fri, 05 Sep 2008
     
    add a note add a note User Contributed Notes
    インストール
    Philipp
    18-Jul-2008 05:20
    When installing or updating php 5.x on Windows 2003 with IIS the installer sets the ISAPI application extension path incrorrectly. (The filename portion of the path is truncated with ~ at the end).

    This causes IIS to not serve any .php pages on any of the configured websites.

    To solve this, open IIS Manager and expand the tree to "websites". Open "websites" properties dialogue and go to the "Home Directory" tab. Click on the "configuration" button.

    In the "Application Configuration" window, select .php from the "Application Extensions" and correct it's path by browsing to the "php5isapi.dll" file in your PHP5 directory.

    Choose to replace this configuration option on all configured websites that make use of php when asked.

    You can also set this option for individual websites only instead of the top-level website.
    jonas at carello dot se
    25-Jun-2008 11:53
    If after installting/upgrading PHP on Windows 2000/2003/2008 server with IIS, you're only getting blank pages (or if examining the headers, HTTP 500 errors), try the following:

    1. Uninstall PHP and remove all traces of it, IIS ISAPI settings, php.ini and the entire PHP directory.

    2. Restart the computer.

    3. Install PHP again, you can install and use extensions if you wish.

    4. Check the ISAPI settings in IIS (or CGI, depending on what you're using).

    5. Restart IIS several times (don't ask me why, it makes no sense).

    6. If it still doesn't work, copy the following files to %WINDIR%\system32\ from your PHP directory.
    (Some files might not exist, I think it depends on your choice of extensions.)

    libmysql.dll (if you're using MySQL)
    libeay32.dll (even if you're not using OpenSSL)
    ssleay32.dll (even if you're not using OpenSSL)
    libmcrypt.dll (If you're using mcrypt)
    libmhash.dll (If you're using mhash)

    7. Restart IIS again.

    8. If it still doesn't work, check if you have additional lib*.dll in your PHP folder and try copying these to %WINDIR%\system32\.

    The above has helped me 3 times when updating my PHP installation (first from 5.05->5.1.4, second from 5.1.4->5.2.1 and today from 5.2.1->5.2.6).
    Each time I've run into the exact same problem, blank pages (500 internal server error).

    I hope this helps someone.
    john dot calder at manukau dot ac dot nz
    04-May-2008 06:19
    WINDOWS 2003 and IIS.  BIG LESSON FOR ME was "don't mess with the optional components".
    I had lots of trouble until I tried installing without asking for extras and then it was very smooth.
    I have found no need to set up paths. 
    I have found no need to configure IIS. 
    I have found no need to change security on the PHP folder.

    What works for me with Windows/IIS:

    1.  You need to be logged-on as "administrator"

    2.  Run  "php-5.2.6-win32-installer.msi"
    Your ONLY action during this wizard is to select "IIS ISAPI" as the webserver.  Do NOT CHANGE anything else!  I am guessing that the optional extras apply only to Apache because after enabling them I see Apache-related error messages.

    3.  Setup a test virtual directory as you would for an ASP or ASP.NET web app.  eg "phptest"
    Then use notepad to create a test page eg "test.php"
    <?php
    phpinfo
    ();
    ?>

    4.  In Internet Explorer, test with eg this address
    http://localhost/phptest/test.php

    IF this does not give you a beautiful page of details THEN start reading other advice on this page - especially helpful for me was the faq advice to test run "php.exe -i" from the command prompt.
    charleslynch at xybersoftware dot com
    18-Apr-2008 03:30
    One final note to the message below if you are getting the message about not having rights to execute...You need to use IIS right click on the website and choose 'Properties/Home Directory' then on the 'Execute Permissions' combo box you need to choose 'Scripts only'...Click ok...another dialog may appear asking which directories to apply the action too...choose any directories that you intend on using php in and click ok...It should work now...
    charleslynch at xybersoftware dot com
    17-Apr-2008 07:50
    To get php 5.2.5 to work in IIS on Windows Server 2003

    1. Install PHP choose the IIS ISAPI webserver option on the first panel of the php install
    2. Make sure your website is accessible for example make sure it works with html files
    3. Now startup IIS and click on the Web Sevice Extensions folder icon, you should see the PHP Hypertext Processor installled and enabled. Click on the 'All Unknown ISAPI Extensions' and then click the 'Allow' button.
    4. Now you need to give the internet users access to the php executable directory ie c:\php or c:\program files\php by using internet explorer and right clicking the php directory and choosing Properties/Security/Add...Now in the 'Select Users or Groups' dialog that appears in the 'Enter the Object Names to select' type in the name of the internet guest account (ie IUSER_TEMPLATE in my case)...click the check names to make sure you got it right and click the OK button.  Finally in the PHP properties dialog click the Internet Guest Account icon and set the permissions to be 'Read & Execute, List Folder Contents and Read'.  Click ok and now it should work.  Create a very simple php file and test it...

    If you get the 404 file not found error then the ISAPI extensions are not allowed (#3 above)
    If you get a blank page then the ISAPI extensions are probably setup right but you need to give the internet user access rights to the php executable directory (#4 above)
    joerg at fenin dot de
    02-Nov-2007 10:35
    To limit HTTP Request Methods on the Apache server running PHP you should use mod_rewrite or mod_security instead of LimitExcept, to give you more control over the handling of such http errors.  Can go in .htaccess file or httpd.conf

    # mod_rewrite
    <IfModule mod_rewrite.c>
      RewriteEngine On
      RewriteCond %{REQUEST_METHOD} !^(GET|HEAD|POST)$
      RewriteRule .* - [F,L]
    </IfModule>

    # mod_security
    <IfModule mod_security.c>
      SecFilterSelective REQUEST_METHOD "!^(GET|HEAD|POST)$" "deny,log,status:403"
    </IfModule>

    You can use the php request method scanner at askapache to see exactly how your server deals with various request methods, and check that your server is configured properly.. 

    http://www.askapache.com/online-tools/request-method-scanner/
    scott at chaisson dot net
    20-Sep-2007 05:18
    Windows 2000 Server and IIS (SP4 and all patches):

    After many frustrating hours of trying to figure out the install (again), It took a while, but here are a couple tips:

    PHP working with IIS uses c:\winnt\php.ini

    It doesn't matter what you set the path to, nor what you set the PHPRC environment variable to. After you get PHP running correctly in the installation folder (using php -i) copy the php.ini file into the c:\winnt folder.

    Here's what worked for me:

    - Add PHP path to System environment variable

    - Add php5activescript.dll from http://snaps.php.net/ to the PHP folder, then Register it: "regsvr32 php5activescript.dll"

    Set extension_dir and doc_root directives in PHP.INI:
      extension_dir = C:\WWW\PHP\ext
      doc_root = C:\WWW\Site
      cgi.force_redirect = 0

    (the last cgi.force_redirect isn't required, but I like to set it anyway)

    Copy the .INI file into WINNT folder

    In IIS Manager, right-click "Default Web Site", Click "Home Directory",
      Click "Configuration", "Add" the ISAPI application:
        Executable: <your php install>\php5isapi.dll
        Extension: .php
        Limit to: GET,HEAD,POST
        Check: "Script Engine"
        Uncheck: "Check that file exists"

    Finally: Set up an ISAPI filter:
      Click the "ISAPI Filters" tab,
      Filter Name: PHP
      Executable: <your php install>\php5isapi.dll

    Notes: You don't have to set any of your folders as "Script source" folders. .PHP files aren't scripts, merely text files that require processing before being shipped off to the browser, which is what the ISAPI filter does.

    Finally, working again.

    Chase
    christianfelix at laszlo dot com
    16-Jul-2007 11:39
    For Windows XP users

    Just add php.ini to windows/system 32 and also save a copy in the setup folder e.g. c:/php/php.ini, c:/php5/php.ini,

    You have to follow the suggestions, add to path, uncomment extensions and voila!!
    Meiki67 skipthis at geemail
    08-Jun-2007 12:41
    Had a hard day to MSI install 5.2.3 on WinXP with MySQL. I use a drive substitution (subst drive: path - in my case subst d: c:\drive_d) and installed PHP in D:\PHP - which in reality is C:\DRIVE_D\PHP.  To make a long story short - only after (1) changing all substituted D:\ back to C:\DRIVE_D and (2) resolving all DOS short names to Win long names PHP started to work. The first one is clear - the substitution works only for the active console user - not for services or IUSR. For the second one I have no explanation, since DOS short names should work systemwide - maybe Win handles them correctly but PHP not ?

    BTW <?php phpinfo(); ?> was of tremendeous help

    Meiki
    gui dot priaulx at gmail dot com
    03-Jun-2007 08:05
    When i first installed PHP 5.2 / 5.1 on Windows 2k3 server standard edition, i got error 404's on every page i tried to load, i then noticed that in the file extention configuration list, .php files where going to E:\PHP\\php5isapi.dll or something similar, the problem was the two back slashes, i'm not sure what their purpose is. After i changed it too one, PHP worked well for about 5 minutes then the Application poop started to crash and a whole new bag of problems fell open, but thats just observation if it helps anyone.
    Curtis
    19-May-2007 03:39
    I have some additional troubleshooting tips for 53.7, which deals with getting a blank screen on your browser when running a PHP script.

    In addition to server misconfiguration, it may also be that PHP isn't configured to output errors to the browser, which is the case if you or your host uses a more secure php.ini. If this is the case, you need to find out where errors are being logged to find out if any errors are preventing normal output from being delivered to the client.

    If you have access to php.ini, check the 'display_errors' directive, which is, by default, located under the 'error_reporting' directive. It's helpful to have 'display_errors' on during debugging phases, but best to have it off in production environments.

    Related functions: http://php.net/ini_set | http://php.net/error_reporting | http://php.net/error_log
    knutw at sparhell dot no
    07-Nov-2006 05:15
    I recntly upgraded from PHP 5.1 to 5.2 on my Windows Server 2003 using IIS6. I selected CGI as before. My PHP folder is as always C:\Program Files\PHP. I also edited my brand new php.ini, enabling all my old extensions and recommended settings for IIS. I like not to keep my old config into a new version.

    After upgrade, I just got blank pages in my browser, and the response status was 404 Not found.

    I checked my installation twice, using this FAQ, but got no way.

    Then I went to IIS Manager, Web Service Extensions. The php Service Extension was Allowed as it should. I deleted the Service Extension and added it. The old extension used short file names containing tilde (PROGRA~) character, but I don'æt know if that gas anything to do with the problem. Anyway, after allowing my" new" Service Extension, pointing to php-cgi.exe as before, mye web sites suddenly worked. So will revommend anyone with thos problem to delete and add the Servcie Extension. It didn't help re-allowing it, restarting IIS or the complete server.
    14-Sep-2006 03:03
    After setting the PHPRC environment variable, none of my PHP files would hit the preprocessor. The browser was just serving out PHP source code right there in the "view source."

    The manual was telling me to set this var to "c:\php," but nothing was working. It's almost as if IIS/Win2000 wasn't reading my php.ini at all.

    After I set that variable to "c:\php\php.ini," all of a sudden I was getting honest to goodness PHP pages working.
    info at kylierose dot com dot au
    02-May-2006 11:22
    I had trouble using IIS and PHP with Firefox. If you are having similar problems then take a look at this article: http://blogs.wdevs.com/shog9/archive/2005/03/09/2668.aspx
    emzeperx at emzeper dot hu
    01-Jan-2006 08:36
    You do not have to restart the whole system make effect of changing the PATH env var. For me (sbs2003) worked automatically.
    on older systems you can use

    set $Path=%path%;c:\php

    command to extend immediately the path var.
    JUSTANOTHERUSER
    14-Aug-2005 07:23
    <LimitExcept GET POST>
    Deny from all
    </LimitExcept>

    Does not work with Apache2+ & PHP5 . Apache Refuses to start
    per dot fikse at ipj dot no
    12-Jul-2005 09:22
    Installing PHP 4 or 5 on Windows Server 2003 x64 results in http error 505. This is not a PHP bug. It is due to running a 32-bit ISAPI DLL under the 64-bit version of IIS 6, as documented here: http://support.microsoft.com/?id=895976

    Solution: Flip the Metabase flag for Enable32bitAppOnWin64 as described in http://support.microsoft.com/?id=894435 ,
    like this: CSCRIPT ADSUTIL.VBS SET W3SVC/AppPools/Enable32bitAppOnWin64 1

    (Alternatively with full path: cscript %SYSTEMDRIVE%\inetpub\adminscripts\adsutil.vbs SET W3SVC/AppPools/Enable32bitAppOnWin64 1)
    patrick hat paddyworks dot com
    23-May-2005 05:52
    In setting up PHP 5.0.4 + IIS 6  I can concur with vlad at vkelman dot com that setting the environment variable PHPRC is ineffective at telling IIS where to look for php.ini.  The only place PHP5 seems to successfully find php.ini is in C:\Windows.  Using PHPIniDir with Apache2 works like a charm, however.
    vlad at vkelman dot com
    02-Mar-2005 04:45
    In addition of what jimo at mail dot azhsv dot com said:

    I don't know which idiot at Microsoft wrote those Knowledge Base articles (http://support.microsoft.com/kb/328360/EN-US/) - maybe the same idiot who created "Web Server Extensions". But the same - adding extensions and enabling them may be achived much simplier: just open III Manager, go to "Web Server Extensions" and add what you need interactively.

    I'm trying to make both PHP 4 and PHP 5 running as modules on my machine, PHP 4 under IIS and PHP 5 under Apache 2. It turns out that it much easier to work with Apache. In particular, it allows to use PHPIniDir directive to point PHP to php.ini file. IIS is supposed to allow it with setting the PHPRC environment variable, but for some reason it doesn't work on my machine so far.
    barry dot fagin at usafa dot af dot mil
    04-Jan-2005 05:22
    Fixing 404 (file not found) errors with PHP 5.0.3 and IIS 6.0

    IIS 6.0 is installed with security settings that don't permit dynamic content.  This means that even if all the hints in the FAQ are paid attention to (.ini modified correctly, security and permissions correct for IUSR_xxx user, etc), you still get 404 errors for all php files. 

    To fix this:  IIS Manager -> expand local computer -> Web Services Extensions -> Add web service or extension -> .php, browse to c:\php\php-cgi.exe or wherever you had the php executable installed. That plus setting the doc_root in the .ini file solved the problem.

    --BF
    furrycod at hotmail dot com
    07-Sep-2004 05:35
    Great WAMP 1.4.4 (Apache 1.*, MySql 4.*, PHP 4.*) installation article at http://www.circaware.com/articles.php?id=2

    This article details how to install these onto a USB stick--which means changing *nothing* on the host PC, such as registry entries, environment variables, files in the Windows path, NT services, ini files, etc.

    The USB stick install seems awkward, but I installed WAMP to my harddrive using this article as a guide (essentially replacing E:\ with C:\), and it works fine.  No more trying to decide where the *real* php.ini or my.ini file is that needs to be changed.
    masternuthin diespammer at yahoo dot com
    23-Jun-2004 11:33
    PHP 4.3.7.7 and IIS 6 (w2k3 standard)

    Followed note from nigel dot salt at hotmail dot com
    but had to modify "Script Map" to "ScriptMap"

    Also, had to follow note from jimo at mail dot azhsv dot com

    after all that - it worked.
    jeff_graham at datacenterservices dot net
    01-Feb-2004 09:51
    As stated within the note "jimo at mail dot azhsv dot com
    29-Nov-2003 04:33
    PHP 4 and IIS 6.0 (Windows Server 2003)," I found the same steps were requiered for installation of PhP 5 beta 3 on my Windows 2003 server (Standard Edition)
    nigel dot salt at hotmail dot com
    14-Dec-2003 01:00
    Finally got IIS 5 and PHP 5 to talk. 

    What worked for me was:

    1) Set
    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\
    W3SVC\Parameters\Script Map]
    ".php"="your path to php\\php.exe"

    2) ensure there is not a php.ini in the windows system folder and that there is one wherever you've put PHP

    3) edit php.ini and set cgi force redirect to 0 and cgi.rfc2616_headers = 1

    4) Put the PHP scripts in their own folder underneath the inetpub root

    5) Open the IIS console, right click your new php folder
    In the Directory tab
     set application name to the name of the folder
     set executable and script as permission
     set application protection to low
    Click configuration and check that .php is mapped to wherever you put
    PHP

    Restart IIS

    Try a very simple PHP page and it should work

    Nigel
    jimo at mail dot azhsv dot com
    30-Nov-2003 03:33
    PHP 4 and IIS 6.0 (Windows Server 2003)

    Had difficulty getting PHP 4.3.3 to work with Win2003 Ent Server for use with SquirrelMail.  Problem found and believed solved.  Appears to be something New with IIS 6.0 (More security by Micro$oft)  Was getting 404 error and php was not being run as a cgi even though it was in extensions and IIS user had rights to execute it. (php from command line operated correctly)

    If you are installing on Windows Server 2003 (only have Enterprise Edition Not sure if this applies to standard edition), and you have done the normal procedures for inclusion of PHP scripts (either ISAPI or CGI) in IIS, you will still get a 404 error when attempting to execute those scripts even though IIS has rights and the extension points to the correct file.  To alleviate this problem, perform the following:

    1.    Open a command prompt window
    2.    Change to C:\windows\system32
    3.    Execute the command:  cscript  iisext.vbs /AddFile c:\php\php.exe 1 php 0 php
    4.    Execute the command:  cscript iisext.vbs /EnFile c:\php\php.exe
    5.    To check for correct execution of the above,
    6.    Execute the command:  cscript IisExt.vbs /ListFile the php extension should be listed

    If you try just step 4 without step 3 you get an error that the file is not in the list (and wont be there till you do step 3 above)

    After this, IIS seems to like the php extension and work normally.

    For additional reference, see the below 3 Micro$oft KB Articles:
    HOWTO: Enable and Disable ISAPI Extensions and CGI Applications in IIS 6.0 (MS KB Article 328360)

    HOWTO List Web Server Extensions and Extension Files in IIS 6.0 (MS KB Article 328505)

    HOWTO Add and Remove Web Service Extension Files in IIS 6.0 (MS KB Article 328419)
    peter dot mosinskisNOSPAM at csuci dot edu
    06-Mar-2003 08:36
    Running Win2K AS + IIS5.0 + PHP 4.3.1, I ran into a nasty problem that I mistakenly thought had to do with something in the php.ini configuration. When I would try to submit a form using the HTTP method GET it would work, but I would get a "404 Page Not Found" error using the POST method.

    All my permissions were set correctly, the php.ini was configured correctly. It had to do with URLScan being installed on IIS (see below)

    Page 404 File Not Found Error When Using POST method in PHP (and Perl, and otherwise)
    -------------------------------------------

    This is related to the Microsoft URLScan utility. If you have this problem, the IIS administrator has probably run the IIS Lockdown tool as well as configured URLScan to reject this type of HTTP method when sent in a URL. These tools are meant to enhance web server security.

    URLScan configuration files can be found in the \WINNT\system32\inetsrv\urlscan folder on the web server. Specifically, the file to modify is urlscan.ini.

    The changes to make are as follows:
    1. Make sure UseAllowVerbs=1 under [options]
    2. Under the [AllowVerbs] section, list your allowed HTTP methods to include:
        GET
        POST

    For more information on the IIS Lockdown tool and URLScan, visit http://technet.microsoft.com
    monroe at peoplego dot com
    18-May-2002 06:32
    INSTALLATION ON OPENBSD 3.1 VIA PORTS COLLECTION
    Would have succeed but no mysql support.
    I commented out the FLAVORS+= dbase filepro mysql mysql_bundled postgresql iodbc in the /usr/ports/www/php4/Makefile and in the configure options added 
    --with-mysql=/usr/local   and it worked.

    Good Luck
    rodent at mighty dot co dot za
    17-Apr-2002 12:46
    On windows 2000 installation I've had PHP simply hanging when running a PHP script.

    To see exactly what is going wrong with PHP in the context of the IUSR_MACHINENAME account create a shortcut on your desktop to point to cmd.exe.

    Right click on the shortcut, and select properties.

    Then check the 'run as a different user' checkbox of the property pages of the shortcut.

    Double click then shortcut, and you will be prompted for a user account to run the cmd.exe shell under.

    Enter IUSR_MACHINENAME (replace machine name with the machine name of your system), and enter the password for the account.

    If you don't know the password for the IUSR account you might need to go change it in Administrative Tools->Computer Management.

    Enter the password, and you will be dropped into a command prompt.

    Now run c:\php\php.exe -i and see if you can catch any error messages.

    On my system it had a problem accessing c:\winnt\system32\browscap.ini which I was then able to sort out.

    Running PHP as the Administrator user didn't give this problem, so being able to impersonate the IIS account was a very useful diagnostic tool.
    tanis22 at hotmail dot com
    13-Nov-2001 07:01
    I figured out why i get this error with just a virtual directory and not the root:

    8. Windows: I have installed PHP, but when I to access a PHP script file via my browser, I get the error: cgi error:
     The specified CGI application misbehaved by not
     returning a complete set of HTTP headers.
     The headers it did return are:
    ---------------------
    Look at the php.ini file and look for

    doc_root =

    set it to nothing so that it does not only look for that directory. I hope it helps people with IIS and PHP
    rggonzalez at iname dot com
    10-Nov-2000 01:40
    Notes on installing PHP (3.x.x or 4.x.x) on a RedHat 6.x Linux box using glibc 2.1.x. When you install it as a DSO  module for Apache (--with-apxs) with the standard RPM's from RedHat for Apache and MySQL, the httpd daemon dies without giving any error message, and without sending any message to the console.

    From a comment by Rasmus Ledorf: this is caused "probably due to a glibc-2.1.x bug related to dynamically loading a library
    linked against pthreads into a binary that isn't linked against
    pthreads.  Try it using --without-mysql and see if it works.  If it does
    then you know it is a mysql-related problem.  To fix it you will need the
    non-threaded mysql client rpm available from www.mysql.com".

    You can also download the source code for MySQL and recompiled it statically, using this configuration options:

     --with-client-ldflags=-all-static
     --with-mysqld-ldflags=-all-static

    You must then re-run the ./configure; make; make install in your PHP source tree to get the PHP shared module working with the new MySQL support.

    Regards,
    Rodolfo Gonzalez.
    rggonzalez@iname.com

    構築時の問題> <データベースに関する問題
    Last updated: Fri, 05 Sep 2008
     
     
    show source | credits | sitemap | contact | advertising | mirror sites