PHP 5는 지원이 종료되었으며 2026년 1월 31일에
지원 중단됩니다. 지원 중단 후에는 조직에서 이전에 조직 정책을 사용하여 레거시 런타임의 배포를 다시 사용 설정한 경우에도 PHP 5 애플리케이션을 배포할 수 없습니다. 기존 PHP 5 애플리케이션은
지원 중단 날짜 이후에도 계속 실행되고 트래픽을 수신합니다.
지원되는 최신 PHP 버전으로 마이그레이션하는 것이 좋습니다.
Modules API 사용
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
Modules API는 현재 운영 환경(모듈, 버전, 인스턴스) 정보를 반환하는 함수를 제공합니다.
Modules API에는 모듈, 버전 또는 인스턴스의 주소를 검색하는 함수도 있습니다. 이를 통해 애플리케이션이 개발 및 프로덕션 환경 모두에서 인스턴스 간에 요청을 전송할 수 있습니다.
파일 맨 위에 다음 use 문을 추가합니다.
다음 코드 샘플에서는 요청의 모듈 이름 및 인스턴스 ID를 가져오는 방법을 보여줍니다.
자동 확장 모듈의 인스턴스 ID가 고유한 base64 인코딩 값(예: e4b565394caa
)으로 반환됩니다.
타겟 모듈의 호스트 이름을 가져와서 동일한 앱에서 모듈 간에 통신할 수 있습니다.
URL Fetch 서비스도 사용할 수 있습니다.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 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 Modules API provides information about the current operating environment, including module, version, and instance details.\u003c/p\u003e\n"],["\u003cp\u003eThis API allows applications to retrieve the address of a module, version, or instance, facilitating inter-instance communication within the development and production environments.\u003c/p\u003e\n"],["\u003cp\u003eTo use the Modules API, you must include the \u003ccode\u003euse google\\appengine\\api\\modules\\ModulesService;\u003c/code\u003e statement at the top of your file.\u003c/p\u003e\n"],["\u003cp\u003eThe API can get the current module name and instance ID, and an automatically scaled module's instance ID will be a unique base64 encoded value.\u003c/p\u003e\n"],["\u003cp\u003eCommunication between modules within the same application can be achieved by fetching the hostname of the target module using the \u003ccode\u003eModulesService::getHostname()\u003c/code\u003e function.\u003c/p\u003e\n"]]],[],null,["# Using the Modules API\n\n| This API is supported for first-generation runtimes and can be used when [upgrading to corresponding second-generation runtimes](/appengine/docs/standard/\n| php-gen2\n|\n| /services/access). If you are updating to the App Engine PHP 7/8 runtime, refer to the [migration guide](/appengine/migration-center/standard/migrate-to-second-gen/php-differences) to learn about your migration options for legacy bundled services.\n\nThe Modules API provides functions that return information about the current\noperating environment (module, version, and instance).\n\nThe Modules API also has functions that retrieve the address of a module, a\nversion, or an instance. This allows an application to send requests from one\ninstance to another, in both the development and production environments.\n\nAdd the following use statement to the top of your file: \n\n use google\\appengine\\api\\modules\\ModulesService;\n\nThe following code sample shows how to get the module name and instance id for\na request: \n\n $module = ModulesService::getCurrentModuleName();\n $instance = ModulesService::getCurrentInstanceId();\n\nThe instance ID of an automatic scaled module will be returned as a unique\nbase64 encoded value, e.g. `e4b565394caa`.\n\nYou can communicate between modules in the same app by fetching the hostname of\nthe target module: \n\n use google\\appengine\\api\\modules\\ModulesService;\n\n $url = 'http://' . ModulesService::getHostname('my-backend') . '/';\n $result = file_get_contents($url);\n\nYou can also use the [URL Fetch](/appengine/docs/legacy/standard/php/issue-requests) service."]]