View Single Post
Old 4th December 2011, 23:20
talkingnews talkingnews is offline
Join Date: Jan 2011
Posts: 65
Thanks: 15
Thanked 5 Times in 5 Posts
Default Problem with fastcgi_param PHP_SELF and php-fpm - partial fix here.

Ubuntu 11.10
Nginx 1.0.10
Zen Cart 1.3.9h - php cart software.

BIG problems with a login page - it just kept redirecting until it threw a "too many redirects" error.

Well, after 18 hours (no joke!) of going round and round in circles, with a little help from the developer of Zen Cart we spotted something:

For a script called, for example, phpinf0.php we get

_SERVER["PHP_SELF"] /phpinf0.php/phpinf0.php

which is clearly wrong and breaks certain scripts.

Finally, I ended up at,2...439#msg-212439

locojohn's server setup is different to mine, and I am using ISPConfig so I have worker pools for php-fpm, so this is what I did:

In /etc/nginx/fastcgi_params , comment out the line

fastcgi_param SCRIPT_NAME $fastcgi_script_name;

- that made Zen cart login work! But... it broke phpmyadmin.

So, my phpmyadmin block now looks like this

PHP Code:
location /phpmyadmin {
root /usr/share/;
index index.php index.html index.htm;
location ~ ^/phpmyadmin/(.+.php)$ {
try_files $uri =404;
root /usr/share/;
include /
fastcgi_param SCRIPT_NAME $fastcgi_script_name# THIS is what needs adding
# .... rest of file etc 
I don't know of any way of "unsetting" a server var/param once it's been set, because obviously, it would be better to REMOVE it from the one place it's causing trouble with the old script and leave the master config untouched, rather than delete it from the master file and have to add it back to various other locations "just in case". Any ideas?

This is noted in php bugs at but nothing has really been done since 2011-07-17 and as they're discussing 5.3.6 and I'm on 5.3.8, I guess it hadn't been resolved. However, it HAS taken up my entire weekend, so I'll be putting some effort into waking the bug report up a bit!
Reply With Quote
Sponsored Links