3

Situation:

Server A & server B installed same Ubuntu 14.04, same nginx version (1.4.6), same virtual host (domain.com) and joomla folder (rsync-ed from server A to B)

But server A only able to display its front page and would display "no file input specified" on any menu items.

If I change in /etc/hosts so that server A's IP would use domain.com after server B tested, it would not failed right away. Only after a few minutes that errror would appear.

There are a few messages on nginx's error log such as below:

2015/02/23 12:01:57 [error] 15515#0: *260609 FastCGI sent in stderr: "PHP message: PHP Notice:  Undefined property: JPagination::$pagesTotal in /var/www/joomla/templates/ashton/html/com_content/featured/default.php on line 76" while reading response header from upstream, client: 10.224.202.152, server: www.domain.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "www.domain.com" 
grepmaster
  • 143
  • 2
  • 4
  • 14

1 Answers1

6

solved it by adding "fastcgi_param SCRIPT_FILENAME"

Example as below

server {
    listen 80;
    root /var/www/joomla;
    index index.php index.html index.htm;
    server_name www.domain.com;

    location / {
        try_files $uri $uri/ /index.php?q=$request_uri;
    }

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }
}
grepmaster
  • 143
  • 2
  • 4
  • 14
  • I have similar problem, and trying to solve since 7-8 days. Here I had posed http://stackoverflow.com/questions/33409539/nginx-shows-php-code-instead-of-executing If you guide me, I am very thankful to you – Manish Sapkal Nov 05 '15 at 10:16
  • this is setting in my virtual host's file. e.g.: /etc/nginx/sites-enabled/domain.com. So make sure your virtual host is working or back to basic to verify you php is working. – grepmaster Nov 21 '15 at 07:49