davidtrina
asked on
Undefined Index when using $_SERVER
I am receiving the following error:
Notice: Undefinded index:
I receive this error only on these variables
$_Server["PHP_AUTH_USER"]
$_Server["PHP_AUTH_PW"]
$_Server["AUTH_TYPE"]
$_Server["HTTP_ACCEPT_CHAR SET"]
$_Server["HTTP_REFERER"]
$_Server["REMOTE_HOST"]
I have tested all the other Server Variables and they work fine.
i.e.
$_Server["REMOTE_PORT"]
$_Server["SERVER_PORT"]
and so on...
these have no problems
I am running Apache_2.0.47-win32-x86-no _ssl Server on Windows NT
and PHP version 4.3.3
I have altered C:\Winnt\php.ini to
register_globals = On
I have also tried to use HTTP_SERVER_VARS instead of _SERVER and it returns the exact same errors on the same Variables
I have also tried $PHP_AUTH_USER does not work either
I have found several places where people have said they were having the same problem but the solutions did not work for me.
Please help!
Notice: Undefinded index:
I receive this error only on these variables
$_Server["PHP_AUTH_USER"]
$_Server["PHP_AUTH_PW"]
$_Server["AUTH_TYPE"]
$_Server["HTTP_ACCEPT_CHAR
$_Server["HTTP_REFERER"]
$_Server["REMOTE_HOST"]
I have tested all the other Server Variables and they work fine.
i.e.
$_Server["REMOTE_PORT"]
$_Server["SERVER_PORT"]
and so on...
these have no problems
I am running Apache_2.0.47-win32-x86-no
and PHP version 4.3.3
I have altered C:\Winnt\php.ini to
register_globals = On
I have also tried to use HTTP_SERVER_VARS instead of _SERVER and it returns the exact same errors on the same Variables
I have also tried $PHP_AUTH_USER does not work either
I have found several places where people have said they were having the same problem but the solutions did not work for me.
Please help!
To get a better picture of things, I recommend just doing a
print_r($_SERVER);
that willl show you all the contents of the array.
print_r($_SERVER);
that willl show you all the contents of the array.
ASKER
give me an example script to use PHP_AUTH_* variables I have tried several different ones with the HTTP authentication but perhaps I am doing it wrong
ASKER
Nevermind I just found a page that says
Also note that this does not work using Microsoft's IIS server and the CGI version of PHP due to a limitation of IIS
I tried to use the Module version with the Apache server but the server would not start when I did this
Also note that this does not work using Microsoft's IIS server and the CGI version of PHP due to a limitation of IIS
I tried to use the Module version with the Apache server but the server would not start when I did this
ah, too bad... I'm not sure how you'd get that information from an IIS webserver.
ASKER
Its not an IIS server but it is an apache server running on windows and I configured it to use CGI with PHP because I could not load a module through the http.conf file
It keeps telling me the file php4apache.dll could not be found even though it is definitely in that location dont know why.
It keeps telling me the file php4apache.dll could not be found even though it is definitely in that location dont know why.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
PHP_AUTH_* variables are only in the $_SERVER array if the user has entered HTTP authentication
HTTP_REFERRER is not set if there is no referrer, i.e. if you just type in a URL directly, or the visitor's browser doesn't do referrals for some reason.