php5 doesn't work

I have a file in my web server's root dir named index.php and when I try to access it I get a blank page if the contents are
Code:
<?php phpinfo(); ?>
but if it is
Code:
<? phpinfo(); ?>
the browser gives me an error:
Code:
The page you are looking for is temporarily unavailable

I installed php5 from ports today and left the compile options on their defaults except for enabling PHP-FPM. I started FPM and can see from netstat that it is listening on 127.0.0.1:9000 like it should be (I left php-fpm.conf as it was). nginx is installed and is allowing me to view html files, the only change I made to its config is that I uncommented the lines regarding PHP-FPM
Code:
location ~ \.php$ {
   root     html;
   fastcgi_pass    127.0.0.1:9000;
   fastcgi_index   index.php;
   fastcgi_param   SCRIPT_FILENAME /scripts$fastcgi_script_name;
   include         fastcgi_params;
}

There is nothing in nginx or php-fpm's logs regarding this. Also, this might be important, when I run php -a it says
Code:
interactive mode enabled
but then shows no prompt and lets me type forever without interpreting and commands I enter.
 
Actually ignore the part about "Page unavailable", I had killed php-fpm so nginx was giving a 502. It gives a blank page on anything .php

I've tried make deinstall reinstall in lang/php5.
 
This line should include DocumentRoot
Code:
fastcgi_param   SCRIPT_FILENAME /scripts$fastcgi_script_name;
So if documentroot is set to /usr/local/nginx/html, than update it as follows and reload the nginx server:

Code:
fastcgi_param  SCRIPT_FILENAME  /usr/share/nginx/html$fastcgi_script_name;
 
This is the default behaviour for PHP. You need to modify the php.ini (also will not exist on FreeBSD by default, copy the example file) and change this line to "On":

Code:
short_open_tag = On

You will need to restart or HUP you HTTP server daemons too afterwards...

thanks Andy.
 
To briefly expand on Andy's answer:
In PHP 5.3 the default for short_open_tag changed from On to Off.

In PHP's core it's still On by default, but it's set to Off in the default php.ini config.
 
Back
Top