0

我已经为 Windows 安装了 Xampp 版本 1.7.7,我想开始学习 php。这里的问题是我无法运行 php 代码。

我试过这个非常简单的例子

<html>
<head>
<title>Hello world!</title>
</head>
<body>
    <?php echo "Hello world!"; ?>
</body>
</html>

Ofcorse 我不双击 php 文件,也不只是在 Firefox 中执行它。我去

 http://localhost/xampp/htdocs/helloworld.php

这是正确的方向,我检查了几次。我也尝试过 index.php,但它也不起作用。我得到这个错误。

Object not found!

The requested URL was not found on this server. If you entered the URL manually
please check your spelling and try again.

If you think this is a server error, please contact the webmaster.

Error 404

localhost
05/21/12 15:17:22
Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4   
Perl/v5.10.1

我已经使用默认选项安装了 Xampp,当我点击管理员(xampp xontrol 面板)时,我得到了经典的橙色页面。当我进入状态菜单时,它显示除了 SMTP 服务和 Tomcat 服务之外的所有内容都已激活。我试图卸载并重新安装 xampp,但没有任何改变。

我也在网上搜索过,但似乎没有任何帮助。谢谢

4

2 回答 2

6

尝试

http://localhost/helloworld.php

如果您将文件保存在 xampp/htdocs/

于 2012-05-21T12:31:37.873 回答
3

试试 http:// localhost/helloworld.php C:...\xampp\htdocs\ 是你的文档根目录,所以服务器从这个文件夹中获取文件,Firefox 可以通过 http://localhost/file 访问它们.php

于 2012-05-21T12:33:06.490 回答