2

下载 XAMPP 后,我无法看到 php 文件。我正在尝试编写一个 php 文件,所以我下载并启动了 XAMPP,但我看不到 PHP 文件出现。当我打开任何简单的东西时:

<?php
echo "Hello World";
?>

只显示一个空白的 Firefox 窗口。有人可以帮忙吗?

4

5 回答 5

3

What directory are you using for your PHP files? This needs to be in the htdocs directory in the xampp directory. Check to see if xampp is running by typing http://localhost in your browser URL. If you see the xampp page come up then it's working fine and you need to check if your PHP files are in the correct location. If nothing shows up then it's xampp that's not working.

I just checked for the document root directory on the xampp website. It's /Applications/XAMPP/htdocs/ if you installed the xampp application in the applications directory.

于 2009-08-26T13:28:01.647 回答
0

将文件夹或文件放在(小写)xampp 文件夹中。Applications/XAMPP/htdocs/xampp 然后尝试 url:localhost/xampp/folder/file.php 这应该可以。

于 2014-02-04T16:21:09.420 回答
0

没有错误消息很难猜测。试试这个:编辑你的 php.ini(我不知道它在 XAMPP 中的位置,但你应该能够找到它)并寻找这个变量设置:

display_errors

如果设置为 Off,请将其设置为 On,然后重新启动 XAMPP。加载页面时,您应该会在屏幕上看到一些有意义的错误消息。

于 2009-08-26T13:45:22.860 回答
0

检查以下内容是否包含在您的 httpd.conf 中

让 Apache 运行 phtml 文件

AddHandler application/x-httpd-php .php .php5 .php4 .php3 .html .htm .phtml
于 2017-05-30T12:16:40.080 回答
-2

Apache 需要在 httpd.conf 文件中进行一些配置,然后才能以应有的尊重对待 PHP 文件。

(只是开玩笑的尊重)

我正在为 Windows 使用 XAMPP,我需要将以下内容添加到 httpd.conf 文件中:

LoadModule php5_module "C:/Program Files/xampp/apache/bin/php5apache2.dll"
AddType application/x-httpd-php-source .phps
AddType application/x-httpd-php .php .php5 .php4 .php3 .phtml

可能还有一些我忘记的细节。那是很久以前。

于 2009-08-25T04:30:59.623 回答