Need help with global variable

mike mike503 at gmail.com
Wed Oct 29 02:23:40 MSK 2008


SERVER_ADDR is defined but empty. i am not sure here what to say...

you -could- hard-code it in the nginx config probably...

On Tue, Oct 28, 2008 at 4:11 PM, Jim Ohlstein <jim.ohlstein at gmail.com> wrote:
> This is the result:
>
> array(40) { ["HOSTNAME"]=>  string(0) "" ["PATH"]=>  string(28) "/usr/local/bin:/usr/bin:/bin" ["TMP"]=>  string(4) "/tmp" ["TMPDIR"]=>  string(4) "/tmp" ["TEMP"]=>  string(4) "/tmp" ["OSTYPE"]=>  string(0) "" ["MACHTYPE"]=>  string(0) "" ["MALLOC_CHECK_"]=>  string(1) "2" ["USER"]=>  string(3) "jim" ["HOME"]=>  string(32) "/path/to/my/domain/root" ["FCGI_ROLE"]=>  string(9) "RESPONDER" ["QUERY_STRING"]=>  string(0) "" ["REQUEST_METHOD"]=>  string(3) "GET" ["CONTENT_TYPE"]=>  string(0) "" ["CONTENT_LENGTH"]=>  string(0) "" ["SCRIPT_FILENAME"]=>  string(41) "/path/to/my/domain/root/test.php" ["SCRIPT_NAME"]=>  string(9) "/test.php" ["REQUEST_URI"]=>  string(9) "/test.php" ["DOCUMENT_URI"]=>  string(9) "/test.php" ["DOCUMENT_ROOT"]=>  string(32) "/path/to/my/domain/root" ["SERVER_PROTOCOL"]=>  string(8) "HTTP/1.1" ["GATEWAY_INTERFACE"]=>  string(7) "CGI/1.1" ["SERVER_SOFTWARE"]=>  string(12) "nginx/0.7.19" ["REMOTE_ADDR"]=>  string(13) "my.ip.add.ress" ["REMOTE_PORT"]=>  string(4) "3719" ["SERVER_ADDR"]=>  string(0) "" ["SERVER_PORT"]=>  string(2) "80" ["SERVER_NAME"]=>  string(17) "mydomain.com" ["REDIRECT_STATUS"]=>  string(3) "200" ["HTTP_HOST"]=>  string(17) "mydomain.com" ["HTTP_USER_AGENT"]=>  string(90) "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3" ["HTTP_ACCEPT"]=>  string(63) "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8" ["HTTP_ACCEPT_LANGUAGE"]=>  string(14) "en-us,en;q=0.5" ["HTTP_ACCEPT_ENCODING"]=>  string(12) "gzip,deflate" ["HTTP_ACCEPT_CHARSET"]=>  string(30) "ISO-8859-1,utf-8;q=0.7,*;q=0.7" ["HTTP_KEEP_ALIVE"]=>  string(3) "300" ["HTTP_CONNECTION"]=>  string(10) "keep-alive" ["HTTP_COOKIE"]=>  string(36) "PHPSESSID=qmuor210i861rct4te1qcmq1o6" ["PHP_SELF"]=>  string(9) "/test.php" ["REQUEST_TIME"]=>  int(1225235084) }
>
> So that variable returns an empty string.
>
> Hmmm...
>
>
> Jim
>
> -----Original Message-----
> From: owner-nginx at sysoev.ru [mailto:owner-nginx at sysoev.ru] On Behalf Of mike
> Sent: Tuesday, October 28, 2008 6:40 PM
> To: nginx at sysoev.ru
> Subject: Re: Need help with global variable
>
> fastcgi_params can be set on the http {} level. i only have them defined once.
>
> var_dump($_SERVER) on the php script. see what it says.
>
> On Tue, Oct 28, 2008 at 3:31 PM, Jim Ohlstein <jim.ohlstein at gmail.com> wrote:
>> I have that in there. Maybe I should add it to the site config file?
>>
>> Jim
>>
>>
>> -----Original Message-----
>> From: owner-nginx at sysoev.ru [mailto:owner-nginx at sysoev.ru] On Behalf Of mike
>> Sent: Tuesday, October 28, 2008 6:19 PM
>> To: nginx at sysoev.ru
>> Subject: Re: Need help with global variable
>>
>> you'd need to set that in a fastcgi_param
>>
>> fastcgi_param  SERVER_ADDR        $server_addr;
>>
>> is what i have. i haven't confirmed or used it though.
>>
>> On Tue, Oct 28, 2008 at 3:13 PM, Jim Ohlstein <jim.ohlstein at gmail.com> wrote:
>>> I am hosting a site that requires the following (according to the developer)
>>> for a script license verification"
>>>
>>>
>>>
>>> "global variable available from the server."
>>>
>>>
>>>
>>> _SERVER['SERVER_ADDR']
>>>
>>>
>>>
>>>
>>>
>>> The best that I can understand is that they need the server's IP address to
>>> be returned.
>>>
>>>
>>>
>>> "SERVER_ADDR" does not seem to be recognized by Nginx. Where do I go with
>>> this?
>>>
>>>
>>>
>>>
>>>
>>> Jim
>>
>>
>>
>
>
>


More information about the nginx mailing list