Forum Moderators: coopster
So my question is, can I "turn them on" from within the PHP script itself, similar to setting the include path with php_ini()?
Thanks,
Matthew
What you could always do if you can't avoid the parts of the script that refer to these parts of the $_SERVER array, but don't want the errors, and don't really care what the script is doing with them, is to set these yourself - the $_SERVER array is a variable, after all - this is almost never done, but I tried it ages ago and it worked. The most reasonable thing, though, would just be to remove those lines of your script which use these variables, if there aren't too many to locate.
Actually, he said "turn them on", not off.
>MatthewHSE
Those vars are very common but none are guaranteed to be. They are set by the server, so if you want them to be available you could do it in the server config I suppose. Also, I believe it's usually REQUEST_URI, rather than DOCUMENT_URI.
regards
From PHP.net
Server variables: $_SERVER [us3.php.net]Note: Introduced in 4.1.0. In earlier versions, use $HTTP_SERVER_VARS.
$_SERVER is an array containing information such as headers, paths, and script locations. The entries in this array are created by the webserver. There is no guarantee that every webserver will provide any of these; servers may omit some, or provide others not listed here. That said, a large number of these variables are accounted for in the CGI 1.1 specification, so you should be able to expect those.