apache_lookup_uri> <apache_get_version
Last updated: Fri, 24 Feb 2012

apache_getenv

(PHP 4 >= 4.3.0, PHP 5)

apache_getenvRetorna uma variável subprocess_env do Apache

Descrição

string apache_getenv ( string $variable [, bool $walk_to_top ] )

Retorna a variável de ambiente do Apache especificada por variable.

Essa função requer Apache 2, caso contrário ela é indefinida.

Parâmetros

variable

A variável de ambiente do Apache

walk_to_top

Se deve ou não retorna a variável de alto-ní­vel disponí­veis em todas as camadas do Apache.

Valor Retornado

O valor da variável de ambiente do Apache se tiver sucesso, ou FALSE se falhar

Exemplos

Exemplo #1 Exemplo de uso da função apache_getenv()

O exemplo abaixo mostra como obter o valor da variável de ambiente do Apache SERVER_ADDR.

<?php
$ret 
apache_getenv("SERVER_ADDR");
echo 
$ret;
?>

O exemplo acima irá imprimir algo similar a:

42.24.42.240

Veja Também



User Contributed Notes
apache_getenv
hela at helawann dot de
17-Aug-2004 11:09
Very easy but VERY cool to use:

For an index.php that will be installed on many servers that are installed in a web without DNS, the page should point to the server itself and, for example for a cups-webinterface to port 631. So, let´s do it:

<a href="/testdir/">testlink</a><br>
<a href="http://<? echo apache_getenv("SERVER_ADDR"); ?>:631/">Cups Webinterface</a><br>

Have a lot of fun . . .

Hela

apache_lookup_uri> <apache_get_version
Last updated: Fri, 24 Feb 2012