Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

As per the question: "Under What Conditions May PHP Server Variables Be Disabled".

Basically on Shared Hosting I am using I can choose to run my website in 'Apache' or 'CGI' mode. When running in 'CGI' mode the PHP Server Variable 'https' is not available, it simply does not exist where in 'Apache' mode it does.

Would this be a result of Safe Mode? Or something similar? Or would this have to be explicitly disabled in the config of PHP?

That's about it, I have had a lot of trouble trying to find an answer for this.

I am not asking for how they may have their hosting setup, I am asking WHY would certain PHP Variables be disabled, or in this case specifically the HTTPS variable, and would it be as a result of Manual interaction, PHP config, or part of some other 'system' i.e. PHP Safe Mode. Is the HTTPS variable a security risk?

share|improve this question
Questions regarding the use of shared web hosting by end users or resellers are off topic because solutions provided by professional system administrators usually cannot be applied in those environments. Contact your hosting provider for support. – Michael Hampton Sep 19 '13 at 16:36
Ok, disregard the fact there is Web Hosting involved. I actually want to know for myself - it is very much a valid question. I also configure hosting locally, and on my own web server... and am a Developer... So I need to know the answer. – Anthony Sep 19 '13 at 16:53
There is nothing in php safe_mode that should relate to this. Is the HTTPS variable the only one with issues? If it is, then I suspect something is wacky with your apache environment. – Daniel Widrick Sep 19 '13 at 17:24
All the reasons a PHP variable might not be defined are numerous. If you were actually the system administrator you could cite what the configurations of these "modes" actually correspond to, and we could help figure out why it does this. – Falcon Momot Sep 19 '13 at 17:25
Thank you, this is all I was looking for... Somewhere to start. In fairness if I knew what I was looking for, or the right question to ask, then I probably wouldn't be at Server Fault asking the question in the first place. It's too easy to take the easy route and say the question is not valid instead of maybe poking at it trying to figure out what the reason is underneath. We all have to learn somewhere, it is far too easy to forget that, and a gentle nudge goes a long way. – Anthony Sep 19 '13 at 21:04
up vote 0 down vote accepted

Refer to the PHP documentation (which you should have read, searched through, or Googled) - specifically this page, which says:

Some server supplied environment variables are not defined in the current » CGI/1.1 specification. Only the following variables are defined there: AUTH_TYPE, CONTENT_LENGTH, CONTENT_TYPE, GATEWAY_INTERFACE, PATH_INFO, PATH_TRANSLATED, QUERY_STRING, REMOTE_ADDR, REMOTE_HOST, REMOTE_IDENT, REMOTE_USER, REQUEST_METHOD, SCRIPT_NAME, SERVER_NAME, SERVER_PORT, SERVER_PROTOCOL, and SERVER_SOFTWARE. Everything else should be treated as 'vendor extensions'.

(Emphasis added.)

Working As Designed.

share|improve this answer
Trust me when I say I looked for this, yet couldn't find it... Hence why I am here. Google does not always have the answer because it depends on asking the right question... And you often have to have an inkling of what you are actually looking for in the first place to ask that question. It also doesn't hurt to ask people maybe in the know before trawling through endless documentation trying to find a needle in a haystack. Just saying ... – Anthony Sep 19 '13 at 21:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.