PHP 5는 지원이 종료되었으며 2026년 1월 31일에
지원 중단됩니다. 지원 중단 후에는 조직에서 이전에 조직 정책을 사용하여 레거시 런타임의 배포를 다시 사용 설정한 경우에도 PHP 5 애플리케이션을 배포할 수 없습니다. 기존 PHP 5 애플리케이션은
지원 중단 날짜 이후에도 계속 실행되고 트래픽을 수신합니다.
지원되는 최신 PHP 버전으로 마이그레이션하는 것이 좋습니다.
php.ini 파일
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
App Engine 애플리케이션에 php.ini 파일을 포함시킬 수 있습니다. 이 파일을 사용하면 PHP 인터프리터 지시문의 동작을 맞춤설정할 수 있습니다.
php.ini 정보
php.ini
파일은 애플리케이션의 기본 디렉터리(app.yaml
파일과 동일한 디렉터리)에 있어야 합니다. PHP 인터프리터가 초기화될 때와 애플리케이션 코드가 실행되기 전에 로드됩니다.
해당 파일은 다른 .ini 파일과 동일한 구문을 따릅니다. 간단한 예는 다음과 같습니다.
; This is a simple php.ini file on App Engine
;
; This is a directive set to "On"
widget_compression = "On"
코어 지시문과 변경 가능한 최빈값의 목록은 php.net에 게시됩니다. 확장 프로그램에서 처리하는 php.ini
지시문은 확장 프로그램 자체의 각 페이지에 설명되어 있습니다.
다음 변경할 수 있는 모드 값 중 하나를 가지는 모든 PHP 지시문을 재정의할 수 있습니다.
PHP_INI_SYSTEM
PHP_INI_ALL
PHP_INI_PERDIR
일부 함수는 PHP의 App Engine 구현에서 사용 중지되었습니다. 해당 함수를 대상으로 하는 지시문은 효과가 없습니다.
동적으로 로드 가능한 확장의 조합은 extension
지시문을 통해 사용 설정될 수 있습니다.
App Engine용 PHP 지시문
다음 지시문은 App Engine 환경에만 적용되며, php.ini 파일에 포함되어 있을 수 있습니다.
google_app_engine.enable_curl_lite
- '1'로 설정하면 기본 제공되는 App Engine 전용 cURL 버전인 'cURL lite'를 사용 설정합니다.
'cURL lite'를 표준 cURL 함수를 사용하는 방식과 동일하게 사용할 수 있습니다. 하지만 소켓이 아닌 후드에서 URL Fetch를 호출하므로 URL Fetch가 없는 함수에서는 CurlLiteMethodNotSupportedException
이 발생합니다.
참고: 'cURL lite'가 cURL 함수를 오버로드하므로 앱은 'curl.so' 확장자와 'cURL lite'를 동시에 사용 설정할 수 없습니다.
google_app_engine.enable_functions
- App Engine에서 비공식적으로 중지되었지만 이 지시문을 사용하여 다시 사용 설정할 수 있는 함수입니다. 쉼표로 구분된 문자열에 함수의 이름을 나열합니다.
google_app_engine.enable_functions = "phpversion, phpinfo"
google_app_engine.allow_include_gs_buckets
- 애플리케이션이 include
또는 require
문을 Google Cloud Storage에 저장된 파일과 함께 사용할 수 있습니다.
참고: 기본 버킷에 #default#
를 사용할 수 있습니다. 이 값은 런타임 시 현재 기본 버킷 이름으로 자동 대체됩니다.
예를 들어 쉼표로 구분된 문자열 형식의 파일이 포함된 bucket_1
및 bucket_2
버킷과 함께 기본 버킷을 나열합니다.
google_app_engine.allow_include_gs_buckets = "#default#, bucket_1, bucket_2"
포함될 수 있는 파일에 버킷 및 경로를 지정할 수도 있습니다. 예를 들면 다음과 같습니다.
google_app_engine.allow_include_gs_buckets = "bucket_1/path_x"
Google Cloud Storage에서 어떤 파일을 포함할 수 있는지 검사를 수행할 때, 제공된 경로는 포함되는 파일 또는 필요한 파일이 되기 위해 파일 이름의 시작 부분과 일치해야 하는 프리픽스로 취급됩니다. 예를 들어 위 경로 예시를 사용하면 gs://bucket_1/path_x/...
의 파일은 프리픽스가 일치하므로 제공된 경로에 포함될 수 있지만 gs://bucket_1 or gs://bucket_1/path_y/
의 파일은 프리픽스가 일치하지 않으므로 포함되지 않습니다.
업로드된 파일이 허용된 포함 버킷으로 이동하면 사용자에게 LFI 공격의 가능성을 알리는 경고 메시지가 생성됩니다. 이 경우 보다 제한적인 경로를 사용하는 것을 고려해야 합니다.
참고: 경로는 파일 프리픽스로 취급되므로 특정 파일(예: google_app_engine.allow_include_gs_buckets = "bucket_1/path_x.ext", "bucket_2/path_z/some_file.ext
)도 포함될 수 있습니다.
google_app_engine.disable_readonly_filesystem
- 기본적으로 PHP 애플리케이션을 파일 시스템에 쓸 수 없습니다.
이 지시문을 '1'로 설정하면 로컬 개발 환경에 대한 제한이 해제됩니다.
그러나 항상 샌드박스 제한 사항이 적용되는 프로덕션에서 실행되는 애플리케이션에는 이 설정이 적용되지 않습니다.
00:07:32,420 --> 00:07:34,595
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-09-04(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[[["\u003cp\u003eThe \u003ccode\u003ephp.ini\u003c/code\u003e file, placed in the base directory of an App Engine application, allows customization of PHP interpreter directives before application code execution.\u003c/p\u003e\n"],["\u003cp\u003eYou can override PHP directives with changeable mode values such as \u003ccode\u003ePHP_INI_SYSTEM\u003c/code\u003e, \u003ccode\u003ePHP_INI_ALL\u003c/code\u003e, and \u003ccode\u003ePHP_INI_PERDIR\u003c/code\u003e, excluding those targeting disabled functions.\u003c/p\u003e\n"],["\u003cp\u003eApp Engine provides specific directives within \u003ccode\u003ephp.ini\u003c/code\u003e, including \u003ccode\u003egoogle_app_engine.enable_curl_lite\u003c/code\u003e to use "cURL lite," and \u003ccode\u003egoogle_app_engine.enable_functions\u003c/code\u003e to re-enable certain soft-disabled functions.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003egoogle_app_engine.allow_include_gs_buckets\u003c/code\u003e directive permits the use of \u003ccode\u003einclude\u003c/code\u003e or \u003ccode\u003erequire\u003c/code\u003e statements with files stored in specified Google Cloud Storage buckets, with path prefix matching.\u003c/p\u003e\n"],["\u003cp\u003eIn local development, \u003ccode\u003egoogle_app_engine.disable_readonly_filesystem\u003c/code\u003e can be set to "1" to allow filesystem writing, but this is not applicable in production due to sandbox restrictions.\u003c/p\u003e\n"]]],[],null,["You can include a php.ini file with your App Engine application. This file\nlets you customize the behavior of the PHP interpreter directives.\n\nAbout php.ini\n\nThe `php.ini` file should be\nplaced in the base directory of an application (the same directory as the\n`app.yaml` file). It is loaded when the PHP interpreter is\ninitialized, and before your application code is run.\n\nThe file follows the same syntax as\n[other .ini files](https://en.wikipedia.org/wiki/INI_file). A simple\nexample might look like: \n\n```php\n; This is a simple php.ini file on App Engine\n;\n; This is a directive set to \"On\"\nwidget_compression = \"On\"\n```\n\nA list of the core directives, along with their changeable mode values,\n[is published on php.net](http://www.php.net/manual/en/ini.list.php).\nThe `php.ini` directives handled by extensions are documented on the\nrespective pages of the extensions themselves.\n\nYou may override any PHP directive that has one of the following changeable mode values:\n\n- `PHP_INI_SYSTEM`\n- `PHP_INI_ALL`\n- `PHP_INI_PERDIR`\n\nNote that some functions\n[have been\ndisabled in the App Engine implementation of PHP](/appengine/docs/legacy/standard/php/runtime#disabled_functions). Directives that target\nthese functions will have no effect.\n\nA set of [dynamically loadable extensions](/appengine/docs/legacy/standard/php/runtime#dynamically_loadable_extensions) can be enabled using the\n`extension` directive.\n\nPHP Directives for App Engine\n\nThe following directives are specific to the App Engine environment. They can\nbe included in the php.ini file.\n\n- **`google_app_engine.enable_curl_lite`** - Enables \"cURL lite\", a built-in, App Engine-specific version of cURL, when set to \"1\". \"cURL lite\" can be used exactly as you would use the standard [cURL functions](http://php.net/manual/en/ref.curl.php), but it calls [URL Fetch](/appengine/docs/legacy/standard/php/issue-requests) under the hood rather than sockets, thus functions with no URL Fetch equivalent, throw a `CurlLiteMethodNotSupportedException`.\n\n Note: An app can't enable the \"curl.so\" extension and \"cURL lite\" at the same time,\n as the latter overloads the cURL functions.\n- **`google_app_engine.enable_functions`** - Functions that have been [soft\n disabled](/appengine/docs/legacy/standard/php/runtime#functions_that_can_be_manually_enabled) in App Engine, but can be re-enabled using this directive. List the function names in a comma delimited string: \n\n ```\n google_app_engine.enable_functions = \"phpversion, phpinfo\"\n ```\n- **`google_app_engine.allow_include_gs_buckets`** - Allows your application to use the [`include`](http://php.net/manual/en/function.include.php) or [`require`](http://us1.php.net/manual/en/function.require.php) statements with files stored in [Google Cloud\n Storage](/appengine/docs/legacy/standard/php/googlestorage).\n\n \u003cbr /\u003e\n\n Note: You can use `#default#` for the default bucket; this value\n will be automatically replaced at runtime with your current default bucket name.\n\n For example, list the default bucket, along with buckets `bucket_1` and `bucket_2`\n containing the files in a comma delimited string: \n\n ```\n google_app_engine.allow_include_gs_buckets = \"#default#, bucket_1, bucket_2\"\n ```\n\n You can also specify a bucket and path to files that can be included, for example: \n\n ```\n google_app_engine.allow_include_gs_buckets = \"bucket_1/path_x\"\n ```\n\n When the check is performed for which files may be included from Google Cloud Storage, the\n supplied path is treated as a prefix that must match the start of the file name in order for it\n to be included or required. For example using the path example above, the supplied\n path would allow users to include files from `gs://bucket_1/path_x/...`\n because the prefix matches but not from `gs://bucket_1 or gs://bucket_1/path_y/` because\n the prefix doesn't match.\n\n If an uploaded file is moved to an allowed include bucket, a warning\n is generated to alert the user to a potential\n [LFI](https://en.wikipedia.org/wiki/File_inclusion_vulnerability)\n attack. If this happens, you should consider using a more\n restrictive path.\n\n **Note:** the path is treated as a file\n prefix; so it could include a specific file\n as well, for example, `google_app_engine.allow_include_gs_buckets = \"bucket_1/path_x.ext\", \"bucket_2/path_z/some_file.ext`.\n- **`google_app_engine.disable_readonly_filesystem`** - By default PHP applications are not allowed to write to the filesystem. Setting this directive to \"1\" will lift the restriction for the local development environment. However, the setting does not apply to applications running in production, which are always subjected to the [sandbox restrictions](/appengine/docs/legacy/standard/php/runtime#the_sandbox)."]]