Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
server {
  listen        80;
  server_name   test.local;

  access_log /var/log/nginx/access.log;
  error_log  /var/log/nginx/error.log;
  root       /var/www/testsite;

  location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        include /etc/nginx/fastcgi_params;
  }
}

Requests to php files just return the code as plain text. Headers do mention PHP, so I presume nginx is talking to PHP properly ..

I've looked over it all too many times now, I feel I must be staring right at the problem. Can anyone help?

share|improve this question
    
You did try everything...except a wildcard * – RobotHumans Dec 13 '13 at 16:31
    
Are you accessing www.example.com/index.php or www.example.com/index.php/something ? – v010dya Dec 14 '13 at 5:15

See if your files are starting with < ? .

If so, and you want to keep them like that, you will need to edit /etc/php5/fpm/php.ini and set short_open_tag from Off to On and restart php-fpm.

sudo nano /etc/php5/fpm/php.ini

Search for short_open_tag and set it to On.

Restart php-fpm

sudo service php5-fpm restart
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.