0

我不知道该怎么办。我和我的一样在这个网站上阅读了相关问题,但这些更改没有奏效。

首先,我编辑了 httpd.conf 文件并取消了 PHP 加载模块行的注释。接下来在收到此错误“/usr/sbin/apachectl: line 82: ulimit: open files: cannot modify limit: Invalid argument”后,我更改ULIMIT_MAX_FILES="ulimit -S -n ulimit -H -nULIMIT_MAX_FILES=""或一些奇怪的事情。这解决了那个错误。

然后我最终添加AddType x-httpd-php .php到 httpd.conf 文件,因为在 stackoverflow 上的上一个问题中也提到了这一点。

但是我仍然只是在 Safari 中看到我的源代码(实际上 Chrome 决定下载PHP 文件——不同的问题/故事)。然后我在这个站点上发现了一个类似于我的问题,并在 php5.conf 文件中添加了一些 AddHandler 行,该文件模仿了 AddHandler 之后文件中的 AddType 行。即使在“sudo apachectl restart”之后仍然无法正常工作。

我很困惑。请帮忙。我只是想开始,所以我可以学习编程,我觉得我已经花了一生的时间在我的浏览器中打印“Hello World”。

4

1 回答 1

1

Whenever a server side script is being served as a file rather than executed as code, it means your server has not been configured properly. Make sure you have enabled the PHP module in your httpd.conf file and restarted the web server by opening preferences and toggling the "Web Sharing" option in the Sharing pane.

As a commenter noted, however, this is not a programming question but is a server administration question. Go look at the resources in serverfault.

于 2011-02-15T21:53:16.100 回答