apache_setenv

(PHP 4 >= 4.2.0, PHP 5, PHP 7)

apache_setenv아파치의 서브프로세스의 환경 변수를 설정합니다

설명

bool apache_setenv ( string $variable , string $value [, bool $walk_to_top = false ] )

apache_setenv()variable로 지정한 아파치 환경 변수를 설정합니다.

Note:

아파치 환경 변수를 설정할 때, 해당하는 $_SERVER 변수는 바뀌지 않습니다.

인수

variable

설정할 환경 변수

value

variable 값.

walk_to_top

모든 아파치 레이어에서 사용할 수 있는 최고 레벨 변수를 설정할 지 여부

반환값

성공 시 TRUE를, 실패 시 FALSE를 반환합니다.

예제

Example #1 apache_setenv()를 사용하여 아파치 환경 변수 설정하기

<?php
apache_setenv
("EXAMPLE_VAR""Example Value");
?>

주의

Note:

apache_setenv()apache_getenv()과 함께 PHP 스크립트에서 읽어들이는 Server Side Includes(.shtml)에 변수를 설정하여 나눠진 페이지에서 같은 값을 사용할 수 있습니다.

참고

  • apache_getenv() - 아파치 서브프로세스의 환경 변수를 가져옵니다

add a note add a note

User Contributed Notes 4 notes

up
1
RLG
18 years ago
If you are using mod_gzip or mod_deflate to compress HTML output, you're not able to send partial file to the browser....

To disable mod_deflate in PHP (if needed), you can tell Apache with this :

apache_setenv('no-gzip', '1');
up
1
phpnotes at kipu dot co dot uk
20 years ago
If you set a variable, either new or existing, the corresponding $_SERVER variable is not changed, and you will have to change it as well.
up
-1
guilleva at gmail dot com
18 years ago
When you need to set the QUERY_STRING variable into a page included with the "virtual" function do this:

virtual ("some_page.shtml?$QUERY_STRING");

apache_setenv does not work for this case.
up
-4
sixxgate at yahoo dot com
21 years ago
When you want to set variables to pass to Server Side Includes (.shtml) included in PHP scripts, use this.
To Top