downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

환경 설정을 바꿀 수 있는 곳> <실행시 설정
Last updated: Fri, 24 Jul 2009

view this page in

설정 파일

설정 파일(php.ini)은 PHP를 시작할 때 읽습니다. PHP 서버 모듈 버전은 웹 서버가 시작할 때 한번만 일어납니다. CGICLI 버전에서는 매번 일어납니다.

php.ini는 세 위치에서 찾아집니다 (순서대로):

  • SAPI 모듈 지정 위치 (아파치 2에서 PHPIniDir 지시어, CGI와 CLI에서 -c 명령줄 옵션, NSAPI에서 php_ini 인수, THTTPD에서 PHP_INI_PATH 환경 변수)

  • PHPRC 환경 변수. PHP 5.2.0 이전에는 아래 언급한 레지스트리 키 이후에 확인했습니다.

  • PHP 5.2.0부터, 다음 레지스트리 위치가 순서대로 찾아집니다: HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x.y.z\IniFilePath, HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x.y\IniFilePath, HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x\IniFilePath. x, y, z는 PHP 메이저, 마이너, 릴리즈 버전을 의미합니다.

  • HKEY_LOCAL_MACHINE\SOFTWARE\PHP\IniFilePath (윈도우 레지스트리 위치)

  • 현재 작업 디렉토리 (CLI 제외)

  • 웹 서버 디렉토리(SAPI 모듈의 경우)나 PHP 디렉토리(윈도우 제외)

  • 윈도우 디렉토리(C:\windowsC:\winnt)(윈도우)나 --with-config-file-path 컴파일 시 옵션

php-SAPI.ini이 존재하면(SAPI는 사용하는 SAPI, 그러므로 파일명은 php-cli.ini, php-apache.ini 등), php.ini 대신 사용합니다. SAPI 이름은 php_sapi_name()으로 확인할 수 있습니다.

Note: 아파치 웹 서버는 시작할 때 디렉토리를 루트로 변경하므로, PHP는 루트 파일시스템에 php.ini가 존재할 경우 이를 읽으려고 시도합니다.

확장에 의해 다뤄지는 php.ini 지시어는 각 확장 페이지에 문서가 있습니다. 핵심 지시어 목록은 부록에 있습니다. 모든 PHP 지시어가 매뉴얼에 나와있지 않을 수 있습니다. PHP 버전에 따른 완전한 지시어 목록은, php.ini 파일을 읽어보십시오. 또는, CVS에서 » 최신 php.ini를 찾아볼 수 있습니다.

Example #1 php.ini 예제

; any text on a line after an unquoted semicolon (;) is ignored
[php] ; section markers (text within square brackets) are also ignored
; Boolean values can be set to either:
;    true, on, yes
; or false, off, no, none
register_globals = off
track_errors = yes

; you can enclose strings in double-quotes
include_path = ".:/usr/local/lib/php"

; backslashes are treated the same as any other character
include_path = ".;c:\php\lib"

PHP 5.1.0부터, .ini 파일 안에서 이미 존재하는 .ini 변수를 참조할 수 있습니다. 예: open_basedir = ${open_basedir} ":/new/dir".



add a note add a note User Contributed Notes
설정 파일
prjorgen at gmail dot com
06-Apr-2009 08:42
Something to note which is not well documented is that when you are specifying the path, it is JUST the path that is needed - not the path and filename. In the registry locations, you need to just put the folder path (e.g. C:\PHP\) and not the full path to the INI file (e.g. C:\PHP\php.ini). This will particularly save you some headaches if you are trying to run multiple versions of PHP on one server!

환경 설정을 바꿀 수 있는 곳> <실행시 설정
Last updated: Fri, 24 Jul 2009
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites