You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4php-user@logging.apache.org by Robert Schneider <r....@artworx.at> on 2012/11/07 12:51:01 UTC

Cannot find superglobal variable $_SERVER

Hi,

I just have switched PHP from 5.3.18 to 5.4.8 and now I get this warning:

log4php: LoggerPatternConverterServer: Cannot find superglobal variable
$_SERVER. in
/home/fa008rz5/www/home/rsn/log4php/src/pattern/LoggerPatternConverterSuperglobal.php
on line *76

What should I now? Or what have I done wrong?

Regards,
Robert


Re: Cannot find superglobal variable $_SERVER

Posted by Robert Schneider <r....@artworx.at>.
Ok, thank you for your help!

The information was already from phpinfo(). I have tried now also SEGPC 
but the effect was the same.

I have now an other file which makes same problem but not with $_SERVER 
rather with $_REQUEST. Again, if I use it once the warning disappears. 
I'm not sure but my impression was that in some script the variable is 
set and others not. Might depend on some circumstances that I don't 
know. But I'm also not a true php expert.

The site runs on 64bit Linux with PHP 5.4.8 but I don't know the Apache 
version.

Regards,
Robert



Am 07.11.2012 15:17, schrieb Ivan Habunek:
> On 7 November 2012 14:59, Robert Schneider <r....@artworx.at> wrote:
>> Yes, variables_order is set to EGPCS. Could I savely change the order, in
>> hope that it might work then?
> Hm, I haven't come across this problem. Just did a quick test locally
> on windows/apache 2.2/php 5.4.8. My variables_order is set to GPCS by
> default. $_SERVER is populated correctly onCLI and on apache.
>
> What's your setup? Make sure you're looking at the right php.ini.
> Sometimes apache is configured to use a different php.inii file than
> the one used by CLI. It's best if you look at phpinfo() output
> instead.
>
> BTW, I'm at apachecon so I might not have enough time to investigate
> this. But I'm back home for the weekend.
>
> Regards,
> Ivan


Re: Cannot find superglobal variable $_SERVER

Posted by Ivan Habunek <iv...@gmail.com>.
On 7 November 2012 14:59, Robert Schneider <r....@artworx.at> wrote:
> Yes, variables_order is set to EGPCS. Could I savely change the order, in
> hope that it might work then?

Hm, I haven't come across this problem. Just did a quick test locally
on windows/apache 2.2/php 5.4.8. My variables_order is set to GPCS by
default. $_SERVER is populated correctly onCLI and on apache.

What's your setup? Make sure you're looking at the right php.ini.
Sometimes apache is configured to use a different php.inii file than
the one used by CLI. It's best if you look at phpinfo() output
instead.

BTW, I'm at apachecon so I might not have enough time to investigate
this. But I'm back home for the weekend.

Regards,
Ivan

Re: Cannot find superglobal variable $_SERVER

Posted by Robert Schneider <r....@artworx.at>.
Hi Ivan!

Yes, variables_order is set to EGPCS. Could I savely change the order, 
in hope that it might work then?

Regards,

Robert



Am 07.11.2012 14:53, schrieb Ivan Habunek:
> On 7 November 2012 13:50, Robert Schneider <r....@artworx.at> wrote:
>> I have found out now that the PHP behaviour seems to be odd. For some reason
>> the $_SERVER variable is Null. If I put an
>> $any_variable_name_that_you_dont_need = $_SERVER;
>> at the begin of the script $_SERVER is set and the warning doesn't apprear
>> anymore.
> Hi Robert.
>
> Could you check if you have "S" in your variables_order setting in php.ini?
>
> If you don't then $_SERVER will not be populated. Check out the docs:
> http://www.php.net/manual/en/ini.core.php#ini.variables-order
>
> Regards,
> Ivan


Re: Cannot find superglobal variable $_SERVER

Posted by Ivan Habunek <iv...@gmail.com>.
On 7 November 2012 13:50, Robert Schneider <r....@artworx.at> wrote:
> I have found out now that the PHP behaviour seems to be odd. For some reason
> the $_SERVER variable is Null. If I put an
> $any_variable_name_that_you_dont_need = $_SERVER;
> at the begin of the script $_SERVER is set and the warning doesn't apprear
> anymore.

Hi Robert.

Could you check if you have "S" in your variables_order setting in php.ini?

If you don't then $_SERVER will not be populated. Check out the docs:
http://www.php.net/manual/en/ini.core.php#ini.variables-order

Regards,
Ivan

Re: Cannot find superglobal variable $_SERVER

Posted by Robert Schneider <r....@artworx.at>.
I have found out now that the PHP behaviour seems to be odd. For some 
reason the $_SERVER variable is Null. If I put an
$any_variable_name_that_you_dont_need = $_SERVER;
at the begin of the script $_SERVER is set and the warning doesn't 
apprear anymore.

Anyone else noted this?

Robert




Am 07.11.2012 12:51, schrieb Robert Schneider:
> Hi,
>
> I just have switched PHP from 5.3.18 to 5.4.8 and now I get this warning:
>
> log4php: LoggerPatternConverterServer: Cannot find superglobal variable
> $_SERVER. in
> /home/fa008rz5/www/home/rsn/log4php/src/pattern/LoggerPatternConverterSuperglobal.php 
>
> on line *76
>
> What should I now? Or what have I done wrong?
>
> Regards,
> Robert
>