# WordPress & Joomla does not work with nginx and PHP



## ikevinjp (Jun 8, 2012)

I have been trying to configure WordPress and Joomla to work with FreeBSD 9.0 inside a jail. 

I got the following problems:


```
* WordPress
WordPress (the initial setup page) won't load at all. It takes a long time and nginx finally gives out time out error.

Error logged in nginx:
2012/06/08 20:53:16 [error] 5965#0: *1 upstream timed out (60: Operation timed out) while reading response header from ups
tream, client: 118.8.153.213, server: smantest-wordpress.rsitecentral.com, request: "GET / HTTP/1.1", upstream: "fastcgi
://192.168.55.100:9000", host: "smantest-wordpress.rsitecentral.com"

* Joomla
Joomla returns this error: 
Fatal error: Call to undefined function session_id() in /usr/local/www/joomla/libraries/joomla/session/session.php on line 94
```


```
worker_processes 2;
events {
    worker_connections  1024;
}

error_log /var/log/errors.log debug;

http {
    include       mime.types;
    default_type  application/octet-stream;
    sendfile        on;
    keepalive_timeout  65;

    server {
        server_name _;
        listen    80;
        location / {
            root   /usr/local/www/nginx/;
            index  index.html;
        }
        error_page   500 502 503 504  /50x.html;
    }

    server {
        server_name smantest-wordpress.rsitecentral.com;
        listen 80;
        location / {
            root   /usr/local/www/wordpress/;
            index  index.php;
        }
        location ~ \.php$ {
            fastcgi_pass   192.168.55.100:9000;
            fastcgi_param  SCRIPT_FILENAME  /usr/local/www/wordpress/$fastcgi_script_name;
            include        fastcgi_params;
        }
        error_page   500 502 503 504  /50x.html;
    }

    server {
        server_name smantest-joomla.rsitecentral.com;
        listen 80;
        location / {
            root   /usr/local/www/joomla/;
            index  index.php;
        }
        location ~ \.php$ {
            fastcgi_pass   192.168.55.100:9000;
            fastcgi_param  SCRIPT_FILENAME  /usr/local/www/joomla/$fastcgi_script_name;
            include        fastcgi_params;
        }
        error_page   500 502 503 504  /50x.html;
    }


}
```

I summarized my installation steps:


```
portsnap fetch 
portsnap extract

------------------------

cd /usr/ports/www/nginx
make config
make install clean

Enable IPv6
Enable HTTP Module
Enable http_addition module
Enable http_cache module
Enable http_webdav module
Enable http_rewrite module
Enable http_ssl module
Enable http_sub_status module
Enable html sample files

--------------------------------

cd /usr/ports/lang/php5
make config
make install clean

--------------------------------

cd /usr/ports/textproc/php5-xml
make install

cd /usr/ports/textproc/php5-simplexml
make install

-------------------------------

cd /usr/ports/databases/php5-mysql
make config
make install clean

-------------------------------

cd /usr/ports/www/spawn-fcgi
make install clean

-------------------------------

cd /usr/ports/databases/mysql55-server
make config
make install clean

... configured database

-------------------------------

cd /usr/local/etc/
cp php.ini-production php.ini

... also configured wp-config.php to connect to MySQL database correctly.
```

I do not think there is something wrong with my jail setup or networking.

Also, just to add that I've tried the pkg_add method, but seems that the updated pcre version is causing a different problem.


----------



## ikevinjp (Jun 8, 2012)

Just to add an additonal note:

I think the fastcgi or PHP is misconfigured or an extension is missing. It cannot be anything else. 

Does anyone know?


----------



## vand777 (Jun 15, 2012)

HOWTO: Install Wordpress 3.x + Nginx + MySQL 5.5


----------

