Why does `$_SERVER['PHP_SELF']` have diff values on `mod_php` and `php-fpm`?

Hey there Y’all,

Me and the DevOps that is putting up the site for our community have found some interesting differences between the contents of the $_SERVER variable on a mod_php and a php-fpm.

While accessing /users/login:

  • On mod_php the contents of $_SERVER['PHP_SELF'] are /index.php
  • On php-fpm the contents of $_SERVER['PHP_SELF'] are /users/login

I’m now somewhat convinced that this is what’s messing the $base and $webroot content after the ServerRequestFactory::getBase(), but I’m not completely sure.

I’m still thinking that this is related to some Apache config, but again, I’m just speculating at this time.

This is getting us both really confused, since under mod_php it just works, but something on the php-fpm side is messing the contents of the $base and $webroot variables on the above mentioned static method of the factory.


Maybe this?

Hey Y’all,

First of all, thanks @KevinPfeifer for your link, I’ll keep that in mind in the future.

But the fact is that this issue came from a lack of attention from my part and the fellah doing the DevOps.

We both failed to make sure that both the SSL and NON SSL vhost files had the same rewrite rules we were testing.

Once we realized that, make them match in both files, it all worked!!