June 26, 2015 Archives

26-06-2015 16:02

cgi.fix_pathinfo and nginx

Hi all,

If you're reading this, you may have ran into the same issue I did.

  • FUDForum gives a 200 HTTP response but 0bytes of data (blank white page)
  • No errors in your logs
I ran into this when Roundcube stopped working for me when I moved my webamail vhosts to a different server.

I found the issue here was that in my fpm php.ini config I had:

cgi.fix_pathinfo = 0

This was the default config for this server.
I changed this to:

cgi.fix_pathinfo = 1

And this got roundcube working. Yay! And it is safer too.

But now FUDForum was broken (see symptoms above). Digging further, I pieced together that the solution was to add the below to your *.php block in nginx:

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

Once this is done you should now be getting 500 internal error pres from your server. The issue is it can't find the GLOBALS.php file due to the include path (well atleast for me anyway)

So then set your include_path in your php pool config for the php pool your FUDForum website is using:

php_value[include_path]  = "/usr/share/php:/usr/share/pear:/var/local/FUDforum/scripts:/var/local/FUDforum/include:/var/local/FUDforum/include/theme/default"

Change the path to match the data folder of your installation (/var/local/FUDforum) You should be right to go.

Ref: http://serverfault.com/questions/514157/how-to-set-php-include-path-for-php-fpm-in-nginx-config

Posted by DaveQB | Permanent Link | Categories: IT

26-06-2015 12:25


So it seems the cgi.fix_pathinfo setting needs to be set to 1 in your php.ini file in order for this line to not break everything in your nginx config:

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

So to wrap up, set:

cgi.fix_pathinfo 1;
In your php.ini.

Posted by DaveQB | Permanent Link | Categories: IT