# Cannot load php page, please help

**URL:** <https://www.ruby-forum.com/t/cannot-load-php-page-please-help/195588>\
**Category:** NGINX\
**Created:** [September 26, 2010, 2:26am UTC](https://www.ruby-forum.com/t/cannot-load-php-page-please-help/195588 "2010-09-26T02:26:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![feelexit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/cc9497/32.png) [@feelexit](https://www.ruby-forum.com/u/feelexit)\
**Post date:** [September 26, 2010, 2:26am UTC](https://www.ruby-forum.com/t/cannot-load-php-page-please-help/195588/1 "2010-09-26T02:26:35Z")

</div>

I have nginx, php 5 and php5-fpm installed on ubuntu 10.04 server  
edition.

After I started the nginx server, I have no problem loading the regular  
html pages. but all .php pages cannot be viewed, firefox just pop out a  
window asking me if I wnat to download the file.

I also tried IE, on IE, it just shows the source code.

I checked both nginx and php5-fpm error log files, didn’t see any  
errors. did I miss something during the configuration?

I dont know if the problem is nginx or php5\_fpm, I need someone to  
point me to the rite direction

Posted at Nginx Forum:

> **[cannot load php page, please help](https://forum.nginx.org/read.php?2,134116,134116#msg-134116)**
>
> I have nginx, php 5 and php5-fpm installed on ubuntu 10.04 server edition. After I started the nginx server, I have no problem loading the regular html pages. but all .php pages cannot be viewed, firefox just pop out a window asking me if I wnat to...

---

<div class="post-metadata">

**Author:** ![feelexit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/cc9497/32.png) [@feelexit](https://www.ruby-forum.com/u/feelexit)\
**Post date:** [September 26, 2010, 2:28am UTC](https://www.ruby-forum.com/t/cannot-load-php-page-please-help/195588/2 "2010-09-26T02:28:20Z")

</div>

Sounds like you’re missing a php location block. You need to show us  
your config. Pastebin it

---

<div class="post-metadata">

**Author:** ![feelexit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/cc9497/32.png) [@feelexit](https://www.ruby-forum.com/u/feelexit)\
**Post date:** [September 26, 2010, 2:35am UTC](https://www.ruby-forum.com/t/cannot-load-php-page-please-help/195588/3 "2010-09-26T02:35:22Z")

</div>

HI, Mike.

here’s my nginx.conf.

```auto
user www-data www-data;
worker_processes 4;

events {
    worker_connections 4;
}

http {
    include mime.types;
    default_type application/octet-stream;

    sendfile on;
    tcp_nopush on;
    tcp_nodelay off;
    keepalive_timeout 5;

    gzip on;
    gzip_comp_level 2;
    gzip_proxied any;
    gzip_types text/plain text/css application/x-javascript
text/xml application/xml application/xml+rss text/javascript;

    include /usr/local/nginx/sites-enabled/*;
}
```

## mike Wrote:

> problem loading the regular  
> configuration?
> 
> > * * *

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,134116,134119#msg-134119](http://forum.nginx.org/read.php?2,134116,134119#msg-134119)

---

<div class="post-metadata">

**Author:** ![feelexit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/cc9497/32.png) [@feelexit](https://www.ruby-forum.com/u/feelexit)\
**Post date:** [September 26, 2010, 2:46am UTC](https://www.ruby-forum.com/t/cannot-load-php-page-please-help/195588/4 "2010-09-26T02:46:29Z")

</div>

Show us which sites-enabled site config this is.

---

<div class="post-metadata">

**Author:** ![feelexit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/cc9497/32.png) [@feelexit](https://www.ruby-forum.com/u/feelexit)\
**Post date:** [September 26, 2010, 5:16am UTC](https://www.ruby-forum.com/t/cannot-load-php-page-please-help/195588/5 "2010-09-26T05:16:55Z")

</div>

Mike, you are rite. I replace my “default” file with this one. now  
everything works.

```auto
server {
  server_name localhost;
  listen 80; # listen on port 80

  root /www; # our root document path
  index index.php index.html index.htm;

  location ~* \.php$ { # for requests ending with .php

    # specify the listening address and port that you configured
previously
    fastcgi_pass 127.0.0.1:9000;

    # the document path to be passed to PHP-FPM
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

    # the script filename to be passed to PHP-FPM
   fastcgi_param PATH_INFO $fastcgi_script_name;

    # include other FastCGI related configuration settings
    include fastcgi_params;
  }
}
```

Posted at Nginx Forum:

> **[Re: cannot load php page, please help](https://forum.nginx.org/read.php?2,134116,134133#msg-134133)**
>
> I have nginx, php 5 and php5-fpm installed on ubuntu 10.04 server edition. After I started the nginx server, I have no problem loading the regular html pages. but all .php pages cannot be viewed, firefox just pop out a window asking me if I wnat to...

---

<div class="post-metadata">

**Author:** ![feelexit](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/cc9497/32.png) [@feelexit](https://www.ruby-forum.com/u/feelexit)\
**Post date:** [September 26, 2010, 3:27am UTC](https://www.ruby-forum.com/t/cannot-load-php-page-please-help/195588/6 "2010-09-26T03:27:27Z")

</div>

in my “/usr/local/nginx/sites-enabled”, theres only one file “default”

here’s the code.

```auto
server {
    listen 80;
    server_name localhost;

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

    # redirect server error pages to the static page /50x.html
    error_page 500 502 503 504 /50x.html;
    location = /50x.html
    {
        root html;
    }
}
```

## mike Wrote:

> Show us which sites-enabled site config this is.
> 
> On Sep 25, 2010, at 5:34 PM, “feelexit” wrote:

Posted at Nginx Forum:  
[http://forum.nginx.org/read.php?2,134116,134124#msg-134124](http://forum.nginx.org/read.php?2,134116,134124#msg-134124)
