# nginx and php 5.3



## zgamer (Nov 7, 2011)

I've setup nginx + php w/fastcgi installs before on FreeBSD but starting with PHP 5.3 I'm running into an issue getting the nginx config to pass with a PCRE dependency.


```
web-1# /usr/local/etc/rc.d/nginx configtest
Performing sanity check on nginx configuration:
nginx: [emerg] the using of the regex "\.php$" requires PCRE library in /usr/local/etc/nginx/nginx.conf:55
nginx: configuration file /usr/local/etc/nginx/nginx.conf test failed
```
Lines 55 through 61 are listed below

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

As this is the first PHP 5.3 I'm doing, I would assume it is related to the PCRE functionality being moved into the core of the PHP.


```
web-1# php -v
PHP 5.3.8 with Suhosin-Patch (cli) (built: Nov  2 2011 22:25:33)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
web-1# /usr/local/sbin/nginx -v
nginx: nginx version: nginx/1.0.8
web-1# uname -a
FreeBSD web-1.testlab.local 8.2-RELEASE-p3 FreeBSD 8.2-RELEASE-p3 #0: Tue Sep 27 18:07:27 UTC 2011     root@i386-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  i386
```

Last patching and port update was on 10/31.

Ideas?


----------



## jrm@ (Nov 7, 2011)

If you don't have any luck with fastcgi, I can confirm it works with www/spawn-fcgi.  I just set this up this weekend following @graudeejs's nice tutorial: http://forums.freebsd.org/showthread.php?t=10728.


----------



## plamaiziere (Nov 7, 2011)

I think you need to build nginx with HTTP_REWRITE_MODULE on.

From the port's Makefile:

```
.if defined(WITHOUT_HTTP_REWRITE_MODULE) || defined(WITHOUT_PCRE)
PKGNAMESUFFIX:= ${PKGNAMESUFFIX}-nopcre
CONFIGURE_ARGS+=--without-http_rewrite_module \
                --without-pcre
```

I've used nginx with php fastcgi, that worked like a charm.

(In French few notes about this: http://www.diablotins.org/index.php/Nginx,_serveur_WEB)


----------

