Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > it.comp.www.php > #20724
| Path | csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | Alessandro Pellizzari <shuriken@amiran.it> |
| Newsgroups | it.comp.www.php |
| Subject | Re: testare se pagina php è in locale o remoto |
| Date | 26 Apr 2016 20:44:17 GMT |
| Lines | 27 |
| Message-ID | <doa291Fjfg0U3@mid.individual.net> (permalink) |
| References | <XuMTy.44586$pt.43233@tornado.fastwebnet.it> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 8bit |
| X-Trace | individual.net wP/rUHNVGcQW4iQ0zjmk6w9v3Cma9O9tP25P32/gRwkiFss0w= |
| Cancel-Lock | sha1:Ba3A+qLmhRmN3mnohmWZQEIQBvc= |
| User-Agent | Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2) |
| Xref | csiph.com it.comp.www.php:20724 |
Show key headers only | View raw
Il Tue, 26 Apr 2016 18:15:51 +0200, leonardo.1+++ ha scritto:
> Esiste una funzione da inserire in una pagina web che permette qualcosa
> del genere?
A parte i vari suggerimenti, io preferisco il metodo deterministico.
Nella configurazione del Virtualhost su Apache (o chi per esso, tipo
nginx) uso, sul server di produzione:
SetEnv APP_ENV production
oppure, sul server locale:
SetEnv APP_ENV test
Poi in PHP uso semplicemente:
$env = getenv('APP_ENV');
In questo modo non hai sorprese, per esempio, se qualcuno ti piazza un
proxy o un load-balancer davanti, e improvvisamente ti trovi con valori
strani in SERVER_NAME.
Bye.
Back to it.comp.www.php | Previous | Next — Previous in thread | Find similar | Unroll thread
testare se pagina php è in locale o remoto "leonardo.1+++" <leonardo.1@fastwebnet.it> - 2016-04-26 18:15 +0200
Re: testare se pagina php è in locale o remoto "ciccio" <21669invalid@mynewsgate.net> - 2016-04-26 16:37 +0000
Re: testare se pagina php è in locale o remoto "leonardo.1+++" <leonardo.1@fastwebnet.it> - 2016-04-26 18:57 +0200
Re: testare se pagina php in locale o remoto Andrea D'Amore <anddam+NOSPAM@brapi.net> - 2016-04-26 18:38 +0200
Re: testare se pagina php in locale o remoto "leonardo.1+++" <leonardo.1@fastwebnet.it> - 2016-04-26 18:44 +0200
Re: testare se pagina php in locale o remoto marcocatarsi@tiscaly.it (Catarsi) - 2016-04-26 22:25 +0200
Re: testare se pagina php è in locale o remoto Alessandro Pellizzari <shuriken@amiran.it> - 2016-04-26 20:44 +0000
csiph-web