我的 Mac 上安装了 xampp。我已经在 httpd-vhosts.conf 中设置了虚拟主机
<VirtualHost *:80>
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "/Users/username/Dropbox/folder/cms backup/test"
ServerName cms.local
ServerAlias cms.local
<Directory "/Users/username/Dropbox/folder/cms backup/test">
Options Indexes FollowSymLinks Includes ExecCGI
AddType application/x-httpd-php .php3 .php
AddOutputFilter INCLUDES .php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
我已取消注释
# Virtual hosts
Include /Applications/XAMPP/etc/extra/httpd-vhosts.conf
更改用户和组
User "my username"
#Group nogroup
Group admin
并添加到主机
127.0.0.1 cms.local
但是当我转到 cms.local/php_file.php 时,我收到服务器 500 错误,并且 php 文件由浏览器下载而不是显示。当我尝试在 localhost/php_file.php 中查看同一页面时,一切正常
任何人都可以给出任何想法为什么它正在下载文件?
日志和标题信息:
标题信息:
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
访问日志:
127.0.0.1 - - [08/May/2013:09:01:58 +1000] "GET /diary.php HTTP/1.1" 200 61851
错误日志:
[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
文件和目录的权限设置为 644,然后我将它们更改为 755。没有区别。