title: xampp virtual host downloading php files in browser (Mac)
body: <p>I have xampp installed on my Mac.  I have setup virtual hosts with this is in httpd-vhosts.conf</p>
  
  <pre><code>    &lt;VirtualHost *:80&gt;
          DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
          ServerName localhost
      &lt;/VirtualHost&gt;
  
      &lt;VirtualHost *:80&gt;
          DocumentRoot "/Users/username/Dropbox/folder/cms backup/test"
          ServerName cms.local
          ServerAlias cms.local
          &lt;Directory "/Users/username/Dropbox/folder/cms backup/test"&gt;
             Options Indexes FollowSymLinks Includes ExecCGI
             AddType application/x-httpd-php .php3 .php 
             AddOutputFilter INCLUDES .php
             AllowOverride All
             Order allow,deny
             Allow from all
          &lt;/Directory&gt;
       &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>I have uncommented </p>
  
  <pre><code>    # Virtual hosts
      Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf
  </code></pre>
  
  <p>Changed user and Group</p>
  
  <pre><code>    User "my username"
      #Group nogroup
      Group admin
  </code></pre>
  
  <p>And added to hosts</p>
  
  <pre><code>    127.0.0.1 cms.local
  </code></pre>
  
  <p>But when I go to cms.local/php_file.php I get a server 500 error and the php file is downloaded by the browser instead of being displayed. Everything works fine when I try to view the same page in localhost/php_file.php</p>
  
  <p>Can anyone give any ideas why it is downloading the file?</p>
  
  <p>Logs and Header info:</p>
  
  <p>Header info:</p>
  
  <pre><code>    Request URL:http://cms.local/diary.php
      Request Method:GET
      Status Code:200 OK
      Request Headersview source
      Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
      Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
      Accept-Encoding:gzip,deflate,sdch
      Accept-Language:en-GB,en-US;q=0.8,en;q=0.6
      Cache-Control:max-age=0
      Connection:keep-alive
      Host:cms.local
      User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.65 Safari/537.31
      Response Headersview source
      Accept-Ranges:bytes
      Connection:Keep-Alive
      Content-Type:application/x-httpd-php
      Date:Tue, 07 May 2013 23:01:58 GMT
      Keep-Alive:timeout=5, max=100
      Server:Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_perl/2.0.4 Perl/v5.10.1
      Transfer-Encoding:chunked
  </code></pre>
  
  <p>Access log:</p>
  
  <pre><code>    127.0.0.1 - - [08/May/2013:09:01:58 +1000] "GET /diary.php HTTP/1.1" 200 61851
  </code></pre>
  
  <p>Error log:</p>
  
  <pre><code>    [Wed May 08 09:05:54 2013] [notice] caught SIGTERM, shutting down
      [Wed May 08 09:06:05 2013] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
      [Wed May 08 09:06:06 2013] [notice] Digest: generating secret for digest authentication ...
      [Wed May 08 09:06:06 2013] [notice] Digest: done
      [Wed May 08 09:06:06 2013] [notice] Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
  </code></pre>
  
  <p>Permissions for the file and directory were set to 644 and then I changed them to 755.  It made no difference.</p>