$_ENV["REMOTE_USER"] lost
Moderator: General Moderators
$_ENV["REMOTE_USER"] lost
Hi all,
I'm migrating an old server that is running Apache/1.3.27 and PHP/4.3.1 on Windows NT to another HW running Apache/2.2.8 and PHP/5.2.6 on Windows XP.
On old server I have lot of scripts that are using $_ENV["REMOTE_USER"] to know which has been the user authorized to get in by Apache auth module.
On new server, using phpinfo, it seems that this array index is still existing but when I try to read the value I get an error. The print_r for $_ENV shows me that there isn't defined. But the phpinfo shows me the correct value.
I've modified the variables_order from "GPCS" to "EGPCS" but no efect.
How can I configure PHP to read this value?
Thanks.
I'm migrating an old server that is running Apache/1.3.27 and PHP/4.3.1 on Windows NT to another HW running Apache/2.2.8 and PHP/5.2.6 on Windows XP.
On old server I have lot of scripts that are using $_ENV["REMOTE_USER"] to know which has been the user authorized to get in by Apache auth module.
On new server, using phpinfo, it seems that this array index is still existing but when I try to read the value I get an error. The print_r for $_ENV shows me that there isn't defined. But the phpinfo shows me the correct value.
I've modified the variables_order from "GPCS" to "EGPCS" but no efect.
How can I configure PHP to read this value?
Thanks.
Re: $_ENV["REMOTE_USER"] lost
Is the new server running PHP as a CGI?
Re: $_ENV["REMOTE_USER"] lost
Yes it is.
Re: $_ENV["REMOTE_USER"] lost
That could be your problem. Certain environment variables related to apache are only available when you run PHP as a Module, since the information that Apache shares with PHP is more complete that way.
Re: $_ENV["REMOTE_USER"] lost
Is this a change on new versions? My old server is running fine with same scripts and variable usage.
Thanks.
Thanks.
Re: $_ENV["REMOTE_USER"] lost
Was the old server running as an Apache module?
Re: $_ENV["REMOTE_USER"] lost
No, the old server is running as a CGI too.
Re: $_ENV["REMOTE_USER"] lost
In that case I am at a loss. I assume you already know that $_ENV["REMOTE_USER"] is only available when a user has authenticated via basic browser auth popup (not "in page" authentication), but other than that I do not know what else could be the problem.
Re: $_ENV["REMOTE_USER"] lost
Thanks for your effort. I'm still investigating how can I solve this issue. At least I can write a global funcion that uses getenv instead to query the $_ENV array itself. Not polite but I hope useful.
Re: $_ENV["REMOTE_USER"] lost
If you can get it via getenv then it is really strange. Is the value present in $_SERVER ?
Re: $_ENV["REMOTE_USER"] lost
Hello ghurtado.
sorry for the delay. I've been "disconnected" for some time.
Yes, the value is present in $_SERVER, as REMOTE_USER and also as PHP_AUTH_USER.
The result for getenv("REMOTE_USER") returns the correct value. But The array $_ENV doesn't contains the array member for this value.
sorry for the delay. I've been "disconnected" for some time.
Yes, the value is present in $_SERVER, as REMOTE_USER and also as PHP_AUTH_USER.
The result for getenv("REMOTE_USER") returns the correct value. But The array $_ENV doesn't contains the array member for this value.
Re: $_ENV["REMOTE_USER"] lost
I have now PHP running as Module and the same behavior.
Confused.
Confused.
Re: $_ENV["REMOTE_USER"] lost
I think the value for remote_user may have been moved from the $_ENV array to the $_SERVER array in some version of PHP. I would go with $_SERVER, which is more recent and less likely to change in the future.
Re: $_ENV["REMOTE_USER"] lost
Ok.
I suposed something similar.
Thanks for your effort.
Hope this thread could be useful for others that have the same question (I'm not the first).
I suposed something similar.
Thanks for your effort.
Hope this thread could be useful for others that have the same question (I'm not the first).