Xampp版本1.7.7 php代码不起作用

时间:2012-05-21 12:29:25

标签: php apache xampp

我已经为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默认选项,当我点击admin(xampp xontrol面板)时,我得到了经典的橙色页面。当我进入状态菜单时,它显示除SMTP服务和Tomcat服务之外的所有内容都已激活。我试图卸载并重新安装xampp并没有改变。

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

2 个答案:

答案 0 :(得分:6)

尝试

http://localhost/helloworld.php

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

答案 1 :(得分:3)

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