LoginSignup
1
1

More than 5 years have passed since last update.

WebMatrix で PHP7 を使用する

Posted at

サイト → 設定 → PHP 設定 には、PHP5.5 までしか表示されません。
WebMatrix で PHP5.6以降や、 PHP7 を使用したい場合は、以下のようにする必要があります。

PHP7 のインストール

Web Platform Installer を使用して PHP7 をインストールします。
ここでは PHP7.0.x(x86) for IIS Express をインストールします。

applicationhost.config の編集

C:\Users\<username>\Documents\IISExpress\config\applicationhost.config を編集します。

fastCgi スキーマ

PHP5.3 など、既存の設定があると思いますので、PHP7 の設定を追記します。


<fastCgi>
    <application fullPath="C:\Program Files (x86)\iis express\PHP\v5.3\php-cgi.exe" activityTimeout="600" requestTimeout="600" instanceMaxRequests="10000">
        <environmentVariables>
            <environmentVariable name="PHP_FCGI_MAX_REQUESTS" value="10000" />
            <environmentVariable name="PHPRC" value="C:\Program Files (x86)\iis express\PHP\v5.3" />
        </environmentVariables>
    </application>
<!-- 追加 -->
    <application fullPath="C:\Program Files (x86)\iis express\PHP\v7.0\php-cgi.exe" activityTimeout="600" requestTimeout="600" instanceMaxRequests="10000">
        <environmentVariables>
            <environmentVariable name="PHP_FCGI_MAX_REQUESTS" value="10000" />
            <environmentVariable name="PHPRC" value="C:\Program Files (x86)\iis express\PHP\v7.0" />
        </environmentVariables>
    </application>
<!-- /追加 -->
</fastCgi>

location スキーマ

WebMatrix の個人用サイトが設定されていると思います。
scriptProcessor のパスを PHP7 のパスに変更します。

    <location path="MyWebSite">
        <system.webServer>
            <handlers>
                <add name="PHP via FastCGI" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\iis express\PHP\v7.0\php-cgi.exe" resourceType="Either" />
            </handlers>
        </system.webServer>
    </location>

IIS Express の再起動

applicationhost.config を修正すると、 IIS Express が自動的に停止することがあります。
サイトを再起動することで、設定が反映されます。

1
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1