PHP 옵션 및 정보

PHP 옵션 및 정보 (PHP Options and Information)

PHP 자체에 대해 많은 정보를 얻고 싶을 때 쓰는 함수들이 이 장에 있어요. 이 페이지에서는 PHP 옵션·정보 함수의 개요를 살펴봐요.

출처: PHP Options and Information

본문

이 함수들은 PHP 자체에 대한 많은 정보를 얻을 수 있게 해줍니다. 예를 들어 런타임 설정(runtime configuration), 로드된 확장, 버전 등이 그것이에요. 그리고 실행 중인 PHP에 대한 옵션을 설정하는 함수도 여기에서 찾아볼 수 있습니다. 아마 가장 잘 알려진 PHP 함수 중 하나인 **phpinfo()**도 이 장에 있어요.

주요 함수들은 다음 범주로 나눌 수 있어요.

  • PHP 옵션/정보 함수
    • phpinfo — PHP 구성 정보를 출력
    • phpversion — 현재 PHP 버전 조회
    • php_sapi_name — 웹 서버와 PHP 사이의 인터페이스 타입 조회
    • php_uname — PHP가 실행 중인 운영체제 정보 조회
    • ini_get, ini_set, ini_get_all, ini_restore, ini_alter, ini_parse_quantity — 설정 값 조회·변경
    • get_cfg_var — PHP 구성 옵션 값 조회
    • getenv, putenv, get_current_user, getopt — 환경 관련
    • extension_loaded, get_loaded_extensions, get_extension_funcs, dl — 확장 관련
    • get_include_path, set_include_path, restore_include_path, get_included_files, get_required_files — include 경로·파일 관련
    • get_defined_constants, get_resources — 상수·리소스 관련
    • assert, assert_options — assertion 관련
    • cli_get_process_title, cli_set_process_title — CLI 프로세스 제목 관련
    • gc_collect_cycles, gc_disable, gc_enable, gc_enabled, gc_mem_caches, gc_status — 가비지 컬렉터(GC) 관련
    • memory_get_usage, memory_get_peak_usage, memory_reset_peak_usage — 메모리 사용량 관련
    • set_time_limit — 최대 실행 시간 제한
    • getlastmod, getmygid, getmyinode, getmypid, getmyuid, getrusage — 실행·파일·프로세스 정보
    • php_ini_loaded_file, php_ini_scanned_files — ini 파일 관련
    • phpcredits — PHP 크레딧 출력
    • sys_get_temp_dir — 임시 디렉터리 경로 조회
    • version_compare — PHP 버전 비교
    • zend_thread_id, zend_version — Zend 엔진 관련 정보

더 알아보기