PHP ファイルを処理するための Apache vhost の設定

PHP ファイルを処理するための Apache vhost の設定

重複の可能性あり:
Apache がファイルを解析しない? ダウンロードのみを送信

説明

現在、vhost を使用して Apache でサイトをセットアップしています。何かを要求すると、PHP ファイルがそのまま返されます。

質問

PHP ファイルを処理するには、vhost をどのように構成すればよいですか?

ステージ

私の vhost 構成:

Listen 8010

<VirtualHost *:8010>
   ServerAdmin [email protected]
   ServerName mysite.org
   ServerAlias www.mysite.org
   DocumentRoot /srv/www/mysite.org/public_html/
   ErrorLog /srv/www/mysite.org/logs/error.log
   CustomLog /srv/www/mysite.org/logs/access.log combined

   DirectoryIndex index.html index.php

   AddType application/x-httpd-php .php
   AddType application/x-httpd-php-source .phps
</VirtualHost>

あるページをリクエストすると PHP の生のファイルが返されます。私は curl を使用してこれをテストしました:

$ curl -I http://localhost:8010/index.php
HTTP/1.1 200 OK
Date: Mon, 15 Oct 2012 20:20:31 GMT
Server: Apache/2.2.16 (Debian)
Last-Modified: Thu, 03 May 2012 16:41:59 GMT
ETag: "48b6a-2871-4bf247b86c3c0"
Accept-Ranges: bytes
Content-Length: 10353
Content-Type: application/x-httpd-php

答え1

mod_php がインストールされ、有効になっていることを確認します。

関連情報