pnoeric
asked on
config option that's visible to PHP?
I have a staging server and a live server, and I run the same code base on both... there's some directives in the PHP to change paths, etc, if it's running on staging. But for that to work, the PHP Script has to be able to ID the machine it's on. (I prefer this to setting a flag every time I want to move the code from staging to live.)
I tried using "if(stristr($_SERVER['HTTP _HOST'], 'localhost'))" which works (since my local apache that I use for testing is just http://localhost)... except I run it on a couple of different staging servers that both resolve as localhost.
Is there some minor Apache option I could set, that would be retrievable in PHP?
(I say minor, since I could probably change 'localhost' to something more machine-specific, but I'd prefer not to. Ideally, it'd be some kind of minor PHP flag I could set in the httpd.conf file, then PHP could just check that.)
thanks-
Eric
I tried using "if(stristr($_SERVER['HTTP
Is there some minor Apache option I could set, that would be retrievable in PHP?
(I say minor, since I could probably change 'localhost' to something more machine-specific, but I'd prefer not to. Ideally, it'd be some kind of minor PHP flag I could set in the httpd.conf file, then PHP could just check that.)
thanks-
Eric
how about using $_SERVER['SERVER_NAME'] or $_SERVER['SERVER_ADDR']
ASKER
unfortunately, the 'SetEnv' didn't work-- I added it but it never showed up in phpinfo() or $_ENV or $_SERVER.
I ended up using $_ENV['computername'].
thx
E
I ended up using $_ENV['computername'].
thx
E
ASKER
(this question can be closed, with no answer)
> I ended up using $_ENV['computername'].
what doies this mean? Apache has no environment variable computername
what doies this mean? Apache has no environment variable computername
ASKER
hmm, it showed up in my apache config-- you know, it might be because I'm using this on my local environment, which is a windows pc. it's fine if my staging and dev servers (both linux) don't have computername, since the test will just fall through.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You might set an apache ENV
SetEnv local 1
should make the ENV 'local' available containing the value 1