0

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.

Rui Jarimba
  • 11,166
  • 11
  • 56
  • 86

2 Answers2

0

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.

theotherian
  • 189
  • 1
  • 9
  • Thanks, but no cigar. I don't see where I could configure mod_php. There's no php.ini by default on the OSX installation of php5. I don't see what I could change to that at present. – Jean Rajotte Jan 26 '11 at 05:21
  • Also, theotherian, the non-localhost domains don't end up calling php, it seems -- apache assigns a header type but doesn't seem to hand the file over to php to process. – Jean Rajotte Jan 26 '11 at 05:35
0

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.

Novikov
  • 4,399
  • 3
  • 28
  • 36
  • Thanks for the suggestion. There are no virtual hosts set up (the include is commented out by default). I don't see any "AddHandler php5-script php" in any conf, yet localhost/info.php executes, so it's not the issue. I added your suggested line and I still get the wonky behaviour. – Jean Rajotte Jan 26 '11 at 05:00
  • Do you restart httpd after changing settings? Just making sure. – Novikov Jan 26 '11 at 19:09