Answer the question
In order to leave comments, you need to log in
How to add your data to $SERVER?
Tell me how to add your data to $_SERVER if the server is running on nginx?
Answer the question
In order to leave comments, you need to log in
1. If you are using nginx+php-fpm then fastcgi_param AAA "bbb";
. It looks like: $_SERVER["AAA"] = "bbb";
2. If you are using nginx+apache then SetEnv VARNAME myvariable
. It looks like: $_SERVER['VARNAME'] = 'myvariable'
.
3. If you want universally, then there are 2 ways:
3.1. nginx to add a magic http header added when passing from nginx to php (x-any-magic-header). It looks like this: $_SERVER['X_HTTP_ANY_MAGIC_HEADER']
. But it is necessary to clean such a header from the user's request. And yes, it's a crutch.
3.2. there is an auto_prepend_file in php (php.ini, .htaccess, poo.d/www.conf - you can cheat everywhere) and there you can directly paste what you need with the php code: $_SERVER['CCC'] = 'ddd';
Depends on what you want and the degree where you are ready to go :-)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question