php - Apache:在此服务器上找不到请求的 URL。 Apache

标签 php windows apache url http-status-code-404

我已经在 Windows XP SP3 上安装了 Apache 2.2 服务器和 PHP 5.3。初始安装后,Apache 加载了测试页面,即

http:/localhost (C:/Program Files/Apache2.2/htdocs/index.html) 显示“有效!”。

配置 Apache 并安装 PHP 后,尝试加载 http:/localhost/phptest.php 即 (C:/testsite/htdocs/phptest.php)。

但这会引发错误:

Not Found. The requested URL /phptest.php was not found on this server.

我现在加载也遇到同样的错误

http://localhost

httpd.conf 编辑:

ServerName localhost:80

DocumentRoot "C:/testsite/htdocs"

<Directory "C:/testsite/htdocs">
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>

LoadModule php5_module "c:/testsite/php/php5apache2_2.dll"
AddType application/x-httpd-php .php
AddHandler application/x-httpd-php .php
PHPIniDir "C:/testsite/php"

文件 php.ini 编辑:

include_path = ".;C:\testsite\php\includes"
extension_dir = "C:/testsite/php/ext/"

系统路径:

PHP 目录已添加到 Windows 路径,例如

PATH=C:\Windows\System32;C:\many_dir;C:\testsite\php

Apache error.log 中唯一的错误是:

Warning: DocumentRoot [C:/Program Files/Apache Software Foundation/Apache2.2 /docs/dummy-host.localhost] does not exist
Warning: DocumentRoot [C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host2.localhost] does not exist
Warning: DocumentRoot [C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host.localhost] does not exist
Warning: DocumentRoot [C:/Program Files/Apache Software Foundation/Apache2.2/docs/dummy-host2.localhost] does not exist

Apache 服务重新启动成功并正在运行。我找不到任何不妥之处。谁能发现任何愚蠢的错误?

最佳答案

尝试在您的 conf 中将 Deny from all 更改为 Allow from all,看看是否有帮助。

关于php - Apache:在此服务器上找不到请求的 URL。 Apache ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20696603/

相关文章:

python - 访问域:port instead of IP:port

php - 尝试使用注册表单中的 PHP/Html 将数据输入 SQL 表

php - 登录后其他页面中的 Codeigniter session 数据不可用

javascript - 每 30 秒运行一次 ajax 并显示倒数计时器

c++ - 从对话框编辑控件中读取 double

javascript - 我可以在 Windows 上使用 javascript 自动化吗?

php - 是否可以为 Azure 上的 PHP Web 应用程序包含 web.config 文件(或等效文件)?

windows - 将整个注册表导出到相对路径

apache - .htaccess 301 重定向仅适用于谷歌机器人

python - 无法识别通过 Django 提供的 iCal 提要