我对 PHP 和 Web 服务器完全陌生。我有一个测试 PHP 文件。当我在终端中运行它时,我可以看到 PHP 正在运行“php /Users/Fryza/Sites/phptest.php”
当我在网络浏览器中输入这些内容时,我收到 403 Forbidden 错误:
http://localhost/~fryza/phptest.php
http://localhost/phptest.php
我有一个包含以下内容的文件(/private/etc/apache2/users/fryza.conf):
<Directory "/Users/fryza/Sites/">
Options FollowSymLinks Indexes MultiViews
AllowOverride All
Order allow,deny
Allow from all
</Directory>
我在 private/etc/apache2/httpd.conf 中的 DocumentRoot 是 /Users/Fryza/Sites/
我也有这个目录 /Library/Webserver/Documents - 我曾经把它作为文档根目录,但它也不能在这个位置工作。
我已经阅读了一堆堆栈溢出帖子,但它们对我不起作用。
apache 服务器肯定正在运行。PHP 正在工作。只是无法让文件加载到浏览器中。
我在跑山狮
我和这里的人做了同样的教程并且遇到了同样的问题: 在 Mac OS X10.8 上访问 localhost 时出现 403 Forbidden error
这是错误日志:
[Mon Oct 28 17:57:17 2013] [notice] caught SIGTERM, shutting down
[Mon Oct 28 17:57:17 2013] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Mon Oct 28 17:57:17 2013] [warn] module php5_module is already loaded, skipping
[Mon Oct 28 17:57:17 2013] [notice] Digest: generating secret for digest authentication ...
[Mon Oct 28 17:57:17 2013] [notice] Digest: done
[Mon Oct 28 17:57:17 2013] [notice] Apache/2.2.24 (Unix) DAV/2 PHP/5.3.26 mod_ssl/2.2.24 OpenSSL/0.9.8y configured -- resuming normal operations
访问日志: ::1 - - [28/Oct/2013:18:05:38 -0700] "GET /~fryza/phptest.php HTTP/1.1" 403 220