如何让 Apache 2.2 加载 *.php?

发布于 2024-09-15 22:46:53 字数 697 浏览 1 评论 0原文

我已经环顾四周几个小时试图让它发挥作用。一般来说,我对编程并不陌生,但我从未用过服务器和 PHP 做过任何事情。我无法让 Firefox 打开根目录 (c:/wamp/www) 中的任何 *.php 页面。它告诉我 Foo 是一个 PHP 脚本,并给了我 2 个选项:用...打开它或保存文件。

首先,我下载并安装了 WAMP。

我可以正常访问 MYSQL 并通过我的本地主机运行 phpinfo() 来生成网页。

我也可以很好地加载 phpMyAdmin。

由于 phpinfo 正在加载页面,我不知道这里出了什么问题。

根据我访问过的站点,我的 Apache httpd.conf 文件已经包含了所有正确的条目:

LoadModule php5_module "c:/wamp/bin/php/php5.3.0/php5apache2_2.dll"

AddType application/x-httpd-php 。 php

AddType application/x-httpd-php .php3

PHPIniDir "c:/wamp/bin/php/php5.3.0"

查看 WAMP 控制台并浏览 Apache 模块,我可以看到 php 5 模块确实已检查。因此,Apache 服务器知道 PHP 存在,知道在哪里可以找到它,已加载它,但无法从我的根目录加载任何 php 文件。我该如何解决这个问题?

I've looked around for hours trying to get this to work. I'm not new to programming in general but I've never done anything with servers and PHP. I can't get Firefox to open any *.php pages in my root directory (c:/wamp/www). It tells me Foo is a PHP script, and gives me 2 options: open it with ... or save file.

To start I downloaded and installed WAMP.

I can access MYSQL fine and run phpinfo() through my localhost which generates the webpage.

I can also load phpMyAdmin fine.

Since phpinfo is loading the page I have no idea what's wrong here.

My httpd.conf file for Apache has all the right entries already according to sites I've visited:

LoadModule php5_module "c:/wamp/bin/php/php5.3.0/php5apache2_2.dll"

AddType application/x-httpd-php .php

AddType application/x-httpd-php .php3

PHPIniDir "c:/wamp/bin/php/php5.3.0"

Looking through the WAMP console and going through the Apache Modules I can see that the php 5 module is indeed checked on. So the Apache server knows the PHP exists, knows where to find it, has it loaded but can't load any php files from my root directory. How do I solve this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清晨说晚安 2024-09-22 22:46:53

您必须通过 http://localhost/ 访问文档,因为只有这样服务器才会收到请求。

如果您使用c:\wamp\www,浏览器不会发出任何请求,只会打开磁盘上的文件。

You must access the documents via http://localhost/, because only then the server will receive the requests.

If you use c:\wamp\www, the browser doesn't make any request and just opens the file on your disk.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文