2
votes

env: ubuntu 9.10 / use gotdeb source / php version 5.3.1 / php5-fpm installed /

php5-fpm is running , and listening 9000 port test by 2 commands below

pgrep php5-fpm
telnet localhost 9000

however if I visit from anthor computer in LAN ,using this address

http://192.168.1.103/index.php

the browser ask me to save this index.php , but if visit index.php , everything goes well

sites-enabled/default file content env: ubuntu 9.10 / use gotdeb source / php version 5.3.1 / php5-fpm installed /

php5-fpm is running , and listening 9000 port test by 2 commands below

pgrep php5-fpm
telnet localhost 9000

however if I visit from anthor computer in LAN ,using this address

http://192.168.1.103/index.php

the browser ask me to save this index.php , but if visit index.html , everything goes well

sites-enabled/default file content

location ~ \.php$ {
    fastcgi_pass 127.0.0.1:9000
    fastcgi_index index.php
    fastcgi_param SCRIPT_FILENAME /var/www/$fastcgi_script_name
    include fastcgi_params
}
3

3 Answers

4
votes

A common pitfall is when your code is using short open tags <? instead of <?php and it's not enabled in php.ini on a fresh install so it won't get parsed.

To enable it set short_open_tag=On

1
votes

It seems you need to set your website's index.

You can see a full example on nginx's official wiki, but here's the relevant part:

location / {
  index    index.html index.htm index.php;
}

As you see, the virtual host needs to know it's supposed to process index.php when accessing the website via it's root dir (i.e. http://domain.com/ or http://domain.com/site/), with no file specified.

0
votes
  1. I do have an index:

    location / {
        index index.php;
    }
    
  2. I am not using <? PHP tags.