# Hiawatha + PHP + FastCGI



## alie (Jan 29, 2013)

Hi,

Can anyone help me how to set up www/hiawatha web-server with lang/php5 and FastCGI?

I have tried changing my hiawatha.conf like this but no success:

```
Hostname = 127.0.0.1
WebsiteRoot = /usr/local/www/hiawatha
StartFile = index.php
AccessLogfile = /var/log/hiawatha/access.log
ErrorLogfile = /var/log/hiawatha/error.log
#ErrorHandler = 404:/error.cgi
```

and /usr/local/etc/hiawatha/php-fcgi.conf

```
PidFile = /var/run/php-fcgi.pid
MaxRequests = 100
Server = /usr/local/bin/php-cgi ; 4 ; /var/lib/hiawatha/php-fcgi.sock ; www:www ; /usr/local/etc/php.ini
```

My browser downloads the index.php instead of displaying it when I try to access my domain.


----------



## swa (Feb 1, 2013)

Hi,

There is (should be) a section in hiawatha.conf named FastCGIserver. Could you please post what's in there ?


----------



## alie (Feb 4, 2013)

This is my FastCGIServer settings



```
FastCGIserver {
       FastCGIid = PHP5
       ConnectTo = /var/lib/hiawatha/php-fcgi.sock
       Extension = php
       SessionTimeout = 30
}
```


----------



## swa (Feb 5, 2013)

Hi,

`# head -3 /usr/local/etc/hiawatha/php-fcgi.conf.sample`

```
# PHP FastCGI configuration

# !! Warning, this tool is deprecated. Use php-fpm instead.
```

Just use php-fpm instead. Take a good look at php-fcgi.sock. The php-fcgi.sock location in /usr/local/etc/hiawatha/hiawatha.conf should match the one in /usr/local/etc/php-fpm.conf. 

Don't forget to enable php-fpm in rc.conf and start it.

`# echo "php_fpm_enable="YES"" >> /etc/rc.conf`
`# /usr/local/etc/rc.d/php-fpm start`


----------

