无法访问 htdocs 目录中的 php 文件

Can not access the php file within the htdocs directory

我在这个目录 C:\xampp\htdocs 中有 test.php 文件。我可以通过这个 link http://localhost:800/xampp/ 访问本地主机然后它出现橙色 XAMPP wlecome window 但是当我输入以下 URL http://localhost:800/xampp/test.php 我得到 The required URL could not be found 的东西。为什么我不能访问这个文件?

Apache 端口:800、4433

MySQL 端口:3306

test.php

<?php
echo "Hello World!";
?>
  • 1) 在 htdocs 目录中创建新文件夹 test 并添加文件 test.php进入这个目录
  • 2) 重启服务器
  • 3) 使用 http://localhost/test/test.php

如果您的文件在 C:\xampp\htdocs 中,您应该使用 http://localhost:800/test.php 访问它。

htdocs 是apache 的默认根目录。 (conf/httpd.conf 中的变量 DocumentRoot