LXXXII. PHP 옵션&정보

소개

이 함수들은 실행 설정, 읽어들인 확장 모듈, 버전 등, PHP에 대한 많은 정보를 얻을 수 있게 합니다. 또한 실행중인 PHP의 설정을 변경하는 함수도 있습니다. PHP에서 가장 널리 알려진 함수 - phpinfo()도 여기에 속합니다.

요구 사항

이 확장 모듈을 빌드할 때 외부 라이브러리가 필요하지 않습니다.

설치

이 함수들은 설치하지 않아도 사용할 수 있습니다; PHP 코어의 일부입니다.

런타임 설정

이 함수의 작동은 php.ini 설정에 영향을 받습니다.

표 1. PHP 옵션/정보 설정 옵션

이름기본값변경가능성
assert.active"1"PHP_INI_ALL
assert.bail"0"PHP_INI_ALL
assert.warning"1"PHP_INI_ALL
assert.callbackNULLPHP_INI_ALL
assert.quiet_eval"0"PHP_INI_ALL
enable_dl"1"PHP_INI_SYSTEM
max_execution_time"30"PHP_INI_ALL
max_input_time"60"PHP_INI_ALL
magic_quotes_gpc"1"PHP_INI_PERDIR|PHP_INI_SYSTEM
magic_quotes_runtime"0"PHP_INI_ALL
PHP_INI_* 상수에 대한 자세한 내용 및 정의는 ini_set()을 참고하십시오

위 설정 지시어에 대한 간단한 설명입니다.

assert.active boolean

assert() 평가를 활성화합니다.

assert.bail boolean

assertion 실패시에 스크립트 실행을 종료합니다.

assert.warning boolean

실패하는 assertion마다 PHP 경고를 발생합니다.

assert.callback string

assertion 실패시에 호출할 사용자 함수.

assert.quiet_eval boolean

assertion 표현 평가 중에 error_reporting()의 현재 설정을 사용합니다. 활성화하면, 평가 도중에 에러가 보여지지 않습니다. (error_reporting(0)에 상당) 비활성화하면, 에러는 error_reporting() 설정에 따라 보여집니다.

enable_dl boolean

이 지시어는 PHP의 아파치 모듈 버전에서만 유용합니다. dl()PHP 확장 모듈을 동적으로 읽어들일 수 있는지 여부를, 가상 서버나 디렉토리 단위로 설정할 수 있습니다.

동적 로딩을 끄는 주 이유는 보안입니다. 동적 로딩으로, 모든 open_basedir 제한을 무시할 수 있습니다. 기본값은 안전 모드를 사용할 때를 제외하고 동적 로딩을 허용합니다. 안전 모드에서는 항상 dl()을 사용할 수 없습니다.

max_execution_time integer

스크립트가 실행할 수 있는 최대 시간을 설정합니다. 이는 잘못 쓰여진 스크립트가 서버를 멈추는 것을 방지합니다. 기본값은 30입니다.

최대 실행 시간은 시스템 호출, 스트림 작업 등에는 영향을 받지 않습니다. 자세한 내용은 set_time_limit()를 참고하십시오.

안전 모드로 실행할 때는 이 설정을 ini_set()으로 변경할 수 없습니다. 안전 모드를 끄거나 php.ini에서 시간 제한을 변경해야 합니다.

max_input_time integer

스크립트가 POST, GET, 파일 업로드 등의 입력 데이터를 받아들이는 최대 시간을 초 단위로 설정합니다. 기본값은 60입니다.

magic_quotes_gpc boolean

GPC (Get/Post/쿠키) 작동의 magic_quotes 상태를 설정합니다. magic_quotes가 on이면, 모든 ' (작은 따옴표), " (큰 따옴표), \ (백슬래쉬), NUL은 자동적으로 백슬래쉬로 이스케이프됩니다.

참고: magic_quotes_sybase 지시어도 ON이면 magic_quotes_gpc가 완전히 교체됩니다. 두 지시어를 모두 활성화하면 작은 따음표는 ''로 이스케이프합니다. 큰 따옴표, 백슬래쉬, NUL은 건들이지 않고, 이스케이프 하지 않습니다.

참고: get_magic_quotes_gpc()

magic_quotes_runtime boolean

magic_quotes_runtime를 활성화하면, 데이터베이스나 텍스트 파일를 포함한, 어떠한 외부 소스에서 데이터를 가져오는 대부분의 함수는 백슬래쉬로 인용됩니다. magic_quotes-sybase도 on이면, 작은 따옴표는 백슬래쉬 대신 작은 따옴표로 이스케이프합니다.

리소스 종류

이 확장 모듈은 리소스형을 정의하지 않습니다.

상수 정의

아래 상수들은 PHP 코어의 일부로, 항상 사용할 수 있습니다.

표 2. 미리 정의된 phpcredits() 상수

상수설명
CREDITS_GROUP1코어 개발자 목록
CREDITS_GENERAL2 일반 공로: 언어 디자인과 컨셉, PHP 4.0 저자와 SAPI 모듈.
CREDITS_SAPI4 PHP의 서버 API 모듈 목록과 그 저자.
CREDITS_MODULES8 PHP의 확장 모듈 목록과 그 저자.
CREDITS_DOCS16 문서 팀을 위한 공로.
CREDITS_FULLPAGE32 보통 다른 플래그와 결합해서 사용합니다. 지정한 다른 플래그의 정보를 포함하는 완전한 개별 HTML 페이지 출력이 필요하다는 것을 지시합니다.
CREDITS_QA64 품질 보증 팀을 위한 공로.
CREDITS_ALL-1 모든 공로, 다음과 동일합니다: CREDITS_DOCS + CREDITS_GENERAL + CREDITS_GROUP + CREDITS_MODULES + CREDITS_QA + CREDITS_FULLPAGE. 모든 태그를 가지는 완전한 개별 HTML 페이지를 생성합니다. 기본값입니다.

표 3. phpinfo() 상수

상수설명
INFO_GENERAL1 설정 옵션줄, php.ini 위치, 빌드 날짜, 웹 서버, 시스템 등.
INFO_CREDITS2 PHP 4 공로. phpcreadits() 참고.
INFO_CONFIGURATION4 PHP 지시어의 현재 로컬과 마스터 값. ini_get() 참고.
INFO_MODULES8 읽어들인 모듈과 관련 설정.
INFO_ENVIRONMENT16 환경 변수 정보. $_ENV으로 사용 가능.
INFO_VARIABLES32 EGPCS(환경, GET, POST, 쿠키, 서버)의 모든 정의된 변수.
INFO_LICENSE64 PHP 라이센스 정보. 라이센스 faq 참고.
INFO_ALL-1 위의 모든 정보를 보여줍니다. 기본값입니다.

ASSERT_ACTIVE (integer)

ASSERT_CALLBACK (integer)

ASSERT_BAIL (integer)

ASSERT_WARNING (integer)

ASSERT_QUIET_EVAL (integer)

차례
assert_options -- Set/get the various assert flags
assert -- Checks if assertion is FALSE
dl -- Loads a PHP extension at runtime
extension_loaded -- Find out whether an extension is loaded
get_cfg_var --  PHP 설정 옵션의 값을 얻습니다.
get_current_user --  현재 PHP 스크립트 소유자의 이름을 얻습니다.
get_defined_constants --  모든 상수와 그 값의 연관 배열을 반환합니다.
get_extension_funcs --  모듈의 함수명을 배열로 반환합니다.
get_include_path --  Gets the current include_path configuration option
get_included_files --  include나 require한 파일명의 배열을 반환합니다.
get_loaded_extensions --  적재된 모든 모듈명을 배열로 반환합니다.
get_magic_quotes_gpc --  Gets the current active configuration setting of magic quotes gpc
get_magic_quotes_runtime --  Gets the current active configuration setting of magic_quotes_runtime
get_required_files -- get_included_files()의 별칭.
getenv -- 환경 변수값을 얻습니다.
getlastmod -- 페이지를 수정한 최종 시간을 얻습니다.
getmygid -- Get PHP script owner's GID
getmyinode -- Gets the inode of the current script
getmypid -- Gets PHP's process ID
getmyuid -- Gets PHP script owner's UID
getopt -- Gets options from the command line argument list
getrusage -- Gets the current resource usages
ini_alter -- ini_set()의 별칭
ini_get_all -- 모든 설정 옵션을 얻습니다.
ini_get -- Gets the value of a configuration option
ini_restore -- 설정 옵션의 값을 복구합니다.
ini_set -- Sets the value of a configuration option
main -- Dummy for main()
memory_get_usage -- Returns the amount of memory allocated to PHP
php_ini_scanned_files -- Return a list of .ini files parsed from the additional ini dir
php_logo_guid -- Gets the logo guid
php_sapi_name --  웹 서버와 PHP 간의 접근 형태를 반환합니다.
php_uname --  Returns information about the operating system PHP was built on
phpcredits -- Prints out the credits for PHP
phpinfo -- Outputs lots of PHP information
phpversion -- Gets the current PHP version
putenv -- Sets the value of an environment variable
restore_include_path --  Restores the value of the include_path configuration option
set_include_path --  Sets the include_path configuration option
set_magic_quotes_runtime --  Sets the current active configuration setting of magic_quotes_runtime
set_time_limit -- 최대 실행 시간을 제한합니다.
version_compare --  Compares two "PHP-standardized" version number strings
zend_logo_guid -- Gets the Zend guid
zend_version -- 현재 젠드 엔진의 버전을 얻습니다.