**已关闭。**此问题需要debugging details。它目前不接受回答。
编辑问题以包括desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem。这将帮助其他人回答这个问题。
17天前关闭
Improve this question
我最近安装了MAMP,当我打开目录时,localhost找不到索引文件,即使它存在(HTTP ERROR 500)。
我的localhost在Apache中设置为90。我试过80和8888,但都不管用。我能够正确地加载localhost:90
,但是每当我输入一个类似http://localhost:90/01_FirstPage/的目录时,它就找不到index.php,即使它存在。
这是日志错误:
[04-Oct-2023 05:53:35 UTC] PHP警告:未知:无法打开流:未找到该文件或目录在线0 [04-Oct-2023 05:53:35 UTC] PHP Fatal error:无法打开所需的“C:/Users/[user]/OneDrive/Documents/U/Web Programming 2/PHP course/CodeDynamicWebsites/CodeDynamicWebsites/01_FirstPage/index.php”(include_path ='.; C:\php\pear')in Unknown on line 0
我也试过其他浏览器。索引文件中的代码为:
<!DOCTYPE html>
<html>
<head>
<title>My First PHP Web Page</title>
</head>
<body>
<?php print('Hello World!'); ?>
</body>
</html>
我该如何解决?
1条答案
按热度按时间px9o7tmv1#
我正在学习Udemy的教程,所以当我第一次安装MAMP时,我将原始目录更改为个人文件夹,它不起作用。在评论提到
.htaccess
之后,我在MAMP中查找了这个文件夹的位置。对于Windows,它保存在C:\MAMP\htdocs.
中我将目录和
localhost
重置为MAMP中的默认值(C:\MAMP\htdocs.
和apache:8888
),并再次尝试加载localhost:8888
。所有这些都完美地加载了htdocs
中的index.php
文件,所以我用我需要的文件替换了htdocs
文件夹中的内容!