# php5 doesn't work



## mhunet (Apr 27, 2011)

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 
	
	



```
<?php phpinfo(); ?>
```
 but if it is 
	
	



```
<? phpinfo(); ?>
```
 the browser gives me an error: 
	
	



```
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

```
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 
	
	



```
interactive mode enabled
```
 but then shows no prompt and lets me type forever without interpreting and commands I enter.


----------



## mhunet (Apr 27, 2011)

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.


----------



## vivek (Apr 27, 2011)

This line should include DocumentRoot

```
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:


```
fastcgi_param  SCRIPT_FILENAME  /usr/share/nginx/html$fastcgi_script_name;
```


----------



## AndyUKG (Apr 27, 2011)

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":


```
short_open_tag = On
```

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

thanks Andy.


----------



## Carpetsmoker (Apr 29, 2011)

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.


----------

