开发者

OS X Apache *.php execute when domain is localhost but downloads file otherwise.

The setup:

On a Mac OS X 10.5.8, with the original Apache 2.2, where the only change is to uncomment

LoadModule php5_module

In the _DocumentRoot_ dir, /Library/Webserver/Documents/, in a file named info.php, write:

<? php phpinfo(); ?>

The problem:

Request http://localhost/info.php and the response is the output from the function (i.e. PHP executed the file).

However, request from domain 127.0.0.1 or 192.168.1.x and the response is the content of the file, w/ 开发者_运维问答a header of Content-Type application/x-httpd-php.

The file is always found via the request, so it's not a hosts mapping problem. However, it's treated as an executable only when the request is for domain localhost. There are no virtual hosts set up in the apache conf, so I figure the behaviour should be the same regardless of the domain.

Any idea how to remedy this so that I could use this server on my LAN?

Thanks.


Not sure if this is the problem, but do you have any allow/deny from all settings on your mod_php module's configuration? I'm not sure if it allows that or not.

The reason I ask is because today I wound up tracking down an issue with a preconfigured Apache instance where mod_proxy was set to only allow on requests from localhost. Switching it to allow requests from 10.* fixed the problem of another machine on the network correctly proxying.


Look at the virtual hosts section of the httpd.confg? Is there anything there that sets the PHP filetype? In either case AddHandler php5-script php should be somewhere in the .conf.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜