PHP 5는 지원이 종료되었으며 2026년 1월 31일에 지원 중단됩니다. 지원 중단 후에는 조직에서 이전에 조직 정책을 사용하여 레거시 런타임의 배포를 다시 사용 설정한 경우에도 PHP 5 애플리케이션을 배포할 수 없습니다. 기존 PHP 5 애플리케이션은 지원 중단 날짜 이후에도 계속 실행되고 트래픽을 수신합니다. 지원되는 최신 PHP 버전으로 마이그레이션하는 것이 좋습니다.
로컬 개발 서버를 사용하여 프로덕션에서 App Engine 애플리케이션을 실행하고 이를 사용해서 App Engine 번들 서비스에 액세스하는 과정을 시뮬레이션할 수 있습니다.
시뮬레이션된 환경에서는 제한된 시스템 기능 및 PHP 5 모듈 가져오기와 같은 일부 샌드박스 제한사항이 적용되지만 요청 제한 시간이나 할당량과 같은 다른 제한사항은 적용되지 않습니다.
또한 로컬 개발 서버는 태스크를 로컬로 실행하여 Datastore, Memcache, Task Queues를 포함한 App Engine용 SDK의 라이브러리에서 제공되는 서비스를 시뮬레이션합니다. 애플리케이션이 개발 서버에서 실행되는 경우, Google API HTTP 엔드포인트를 사용하여 프로덕션 인프라에 대한 원격 API 호출을 수행할 수 있습니다.
시작하기 전에
PHP 5가 지원 종료에 도달했으므로 더 이상 최신 버전의 dev_appserver.py를 사용하여 애플리케이션을 로컬로 실행할 수 없습니다. devapp_server.py의 보관처리된 버전을 다운로드하려면 다음 안내를 따르세요.
보관 파일에서 지원 종료에 도달한 런타임을 위한 dev_appserver.py 서버가 포함된 압축된 폴더를 다운로드합니다.
디렉터리 콘텐츠를 /home 디렉터리와 같은 로컬 파일 시스템에 추출합니다. google_appengine/ 디렉터리에서 dev_appserver.py를 찾을 수 있습니다.
로컬 개발 서버 설정
로컬 개발 서버 도구를 실행하려면 다음을 설정해야 합니다.
버전 2.7.12 이상의 Python 2 인터프리터가 설치되었는지 확인합니다.
셸의 DEVAPPSERVER_ROOT 환경 변수를 Python 2 인터프리터 경로로 설정합니다.
로컬 개발 서버 실행
로컬 개발 서버를 설정하고 앱의 app.yaml 구성 파일을 만든 후 dev_appserver.py 명령어를 사용하여 앱을 로컬에서 실행합니다.
로컬 개발 서버를 시작하려면 다음 안내를 따르세요.
app.yaml 구성 파일이 포함된 디렉터리에서 dev_appserver.py 명령어를 실행합니다.
[DEVAPPSERVER_ROOT]를 devapp_server.py의 보관처리된 버전을 추출하는 폴더 경로로 바꿉니다.
로컬 서버는 sendmail 명령어를 사용하여 설치 기본 구성으로 이메일 메시지를 보냅니다.
URL 가져오기 사용
애플리케이션이 URL Fetch API를 사용하여 HTTP 요청을 수행하는 경우 로컬 개발 서버는 컴퓨터에서 직접 요청을 수행합니다. 웹사이트 액세스에 프록시 서버를 사용하는 경우, 로컬 서버에서의 URL 가져오기 동작은 프로덕션 App Engine의 경우와 다를 수 있습니다.
XDebug로 로컬 디버깅
XDebug 디버거와 호환되는 디버거가 있고 xdebug 모듈을 설치한 경우 로컬 개발 서버에서 XDebug를 사용할 수 있습니다.
Linux 또는 macOS의 개발 서버에서 XDebug를 사용 설정하려면 다음 단계를 따르세요.
[[["이해하기 쉬움","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 local development server simulates the production environment for App Engine applications, including access to bundled services like Datastore and Memcache, but with certain sandbox restrictions.\u003c/p\u003e\n"],["\u003cp\u003eDue to PHP 5's end of support, users must download and extract an archived version of \u003ccode\u003edev_appserver.py\u003c/code\u003e to run applications locally.\u003c/p\u003e\n"],["\u003cp\u003eTo set up the local development server, a Python 2 interpreter (version 2.7.12 or later) must be installed, and the \u003ccode\u003eDEVAPPSERVER_ROOT\u003c/code\u003e environment variable must be configured.\u003c/p\u003e\n"],["\u003cp\u003eThe local development server can be started by running the \u003ccode\u003edev_appserver.py\u003c/code\u003e command in the directory containing the \u003ccode\u003eapp.yaml\u003c/code\u003e configuration file, with options to specify the port and PHP-CGI path, if necessary.\u003c/p\u003e\n"],["\u003cp\u003eThe local development server allows for testing features such as email sending, authentication, and data storage, providing a local simulation of their production counterparts while also enabling direct HTTP requests and XDebug compatibility.\u003c/p\u003e\n"]]],[],null,["You can use the local development server to simulate\nrunning your App Engine application in production as well as use it to\naccess App Engine bundled services.\n\nThe simulated environment enforces some sandbox restrictions, such as restricted\nsystem functions and PHP 5 module imports, but not others, like\nrequest timeouts or quotas.\n\nThe local development server also simulates the services provided by the\nlibraries in the SDK for App Engine, including Datastore, Memcache, and\nTask Queues, by performing their tasks locally. When your application is\nrunning in the development server, you can still make remote API calls to the\nproduction infrastructure using Google APIs HTTP endpoints.\n\nBefore you begin\n\nSince PHP 5 has reached the [end of support](/appengine/docs/standard/lifecycle/runtime-lifecycle#end_of_support), you can no longer use the\nlatest version of `dev_appserver.py` to locally run your\napplications. To download an archived version of `devapp_server.py`, follow these\nsteps:\n\n1. From the [archive](https://storage.googleapis.com/appengine-sdks/frozen_devappserver2_cloudsdk/google_appengine_cloudsdk.zip), download the zipped folder that contains the\n `dev_appserver.py` server for runtimes that have reached the end of support.\n\n2. Extract the directory's contents to your local file system, such as to your `/home` directory. You can find `dev_appserver.py` in the `google_appengine/` directory.\n\nSet up the local development server\n\nTo run the local development server tool, you must set up the following:\n\n1. Verify that you have installed a Python 2 interpreter of version 2.7.12 or later.\n\n2. Set the `DEVAPPSERVER_ROOT` environment variable in your shell to\n the path of your Python 2 interpreter.\n\nRun the local development server\n\nAfter [setting up the local development server](#set-up) and creating the\n[`app.yaml`](/appengine/docs/legacy/standard/php/config/appref)\nconfiguration file for your app, you can use the `dev_appserver.py` command to\nrun your app locally.\n\nTo start the local development server:\n\n1. In the directory that contains your `app.yaml` configuration file, run\n the `dev_appserver.py` command.\n\n\n Windows / macOS\n\n \u003cbr /\u003e\n\n Specify the directory path to your app, for example: \n\n python2 [DEVAPPSERVER_ROOT]/google_appengine/dev_appserver.py [PATH_TO_YOUR_APP]\n\n Alternatively, you can specify the configuration file of a specific\n service, for example: \n\n python2 [DEVAPPSERVER_ROOT]/google_appengine/dev_appserver.py app.yaml\n\n To change the port, you include the `--port` option: \n\n python2 [DEVAPPSERVER_ROOT]/google_appengine/dev_appserver.py --port=9999 [PATH_TO_YOUR_APP]\n\n Replace `[DEVAPPSERVER_ROOT]` with the path to the folder where you\n extract the [archived version](#before_you_begin) of `devapp_server.py`.\n\n\n | **Note:** The SDKs for macOS and Windows already include binaries for the PHP 5 runtime so there is no need to separately install PHP.\n\n Linux / cust. php-cgi\n\n If you're on Linux or if you want to use a custom version of `php-cgi`,\n you need to specify the directory path to the `php-cgi`:\n 1. Build your own version of [App Engine PHP Extension](https://github.com/GoogleCloudPlatform/appengine-php-extension)\n on your local machine.\n\n 2. Start the local development server with both the\n `--php_executable_path` and `--php_gae_extension_path` options:\n\n python2 \u003cvar translate=\"no\"\u003eDEVAPPSERVER_ROOT\u003c/var\u003e/google_appengine/dev_appserver.py --php_executable_path=[PATH_TO_PHP_CGI] --php_gae_extension_path=[PATH_TO_APPENGINE_EXTENSION] app.yaml\n\n Replace:\n - \u003cvar translate=\"no\"\u003eDEVAPPSERVER_ROOT\u003c/var\u003e with the path to the folder where you extract the [archived version](#before_you_begin) of `devapp_server.py`.\n - `--php_executable_path` with the location of the PHP interpreter.\n - `--php_gae_extension_path` with the location of the `gae_runtime_module.so` file that you built in the previous step.\n\n To learn more about the `dev_appserver.py` command options, see\n [Local development server options](/appengine/docs/legacy/standard/php/tools/local-devserver-command).\n2. The local development server is now running and listening for requests. You\n can visit \u003chttp://localhost:8080/\u003e in your web\n browser to see the app in action.\n\n If you specified a custom port with the `--port` option, remember to open\n your browser to that port.\n\nTo stop the local server from the command line, press the following:\n\n- macOS or Linux: \u003ckbd\u003eControl+C\u003c/kbd\u003e\n- Windows: \u003ckbd\u003eControl+Break\u003c/kbd\u003e\n\nSpecify application IDs\n\nTo access your App ID in the local server, for example to spoof an email\naddress, use the\n\n\n[`AppIdentityService::getApplicationId`](/appengine/docs/legacy/standard/php/refdocs/classes/google.appengine.api.app_identity.AppIdentityService#method_getApplicationId)\n\n\nfunction. To get the hostname of the running app, use the\n\n\n[`AppIdentityService::getDefaultVersionHostname`](/appengine/docs/legacy/standard/php/refdocs/classes/google.appengine.api.app_identity.AppIdentityService#method_getDefaultVersionHostname)\n\n\nfunction.\n\nDetecting application runtime environment\n\n\u003cbr /\u003e\n\nTo determine whether your code is running in production or in the local\ndevelopment server, you can check the value of the `SERVER_SOFTWARE` environment\nvariable:\n\n\n if (strpos(getenv('SERVER_SOFTWARE'), 'Development') === 0){\n echo 'Local development server';\n } else {\n echo 'Production';\n }\n\n\nStore data\n\nApp Engine for PHP supports [reading and writing to\nCloud Storage](/appengine/docs/legacy/standard/php/googlestorage) via PHP's streams\nAPI. You can read and write to Cloud Storage by specifying a\nCloud Storage URI (`gs://`) when using any PHP function that supports\nPHP Streams implementation such as\n[fopen](http://php.net/manual/en/function.fopen),\n[fwrite](http://php.net/manual/en/function.fwrite) or\n[file_get_contents](http://php.net/manual/en/function.file-get-contents).\n\nThe local development server emulates this functionality by reading and writing\nto temporary local files that are preserved between requests.\n\nBrowse the local Datastore\n\nIf your app has written data to your local Datastore using the local development\nserver, you can browse it in the local development console.\n\nTo browse local Datastore:\n\n1. [Start the development server](#running_the_local_development_server).\n\n2. Access the [Datastore Viewer](http://localhost:8000/datastore) in the\n local development console. (The URL is `http://localhost:8000/datastore`.)\n\n3. View your local Datastore contents.\n\nUse the Users service\n\nApp Engine provides a\n[Users Service](/appengine/docs/legacy/standard/php/users) to simplify\nauthentication and authorization for your application. The local development\nserver [simulates the behavior of Google\nAccounts](/appengine/docs/legacy/standard/php/users#Google_accounts_and_the_development_server)\nwith its own sign-in and sign-out pages. While running under the local\ndevelopment server, the\n\n\n[`createLoginURL`](/appengine/docs/legacy/standard/php/refdocs/classes/google.appengine.api.users.UserService#method_createLoginURL)\nand [`createLogoutURL`](/appengine/docs/legacy/standard/php/refdocs/classes/google.appengine.api.users.UserService#method_createLogoutURL)\n\nfunctions return URLs for `/_ah/login` and `/_ah/logout` on the local server.\n\nUse Mail\n\nThe local development server can send email for calls to the App Engine\nmail service using either an SMTP server or a local installation of\n[Sendmail](http://www.sendmail.org/). \n\nUsing SMTP\n\n\nTo enable mail support with an SMTP server, invoke `dev_appserver.py` as\nfollows:: \n\n python2 [DEVAPPSERVER_ROOT]/google_appengine/dev_appserver.py --smtp_host=smtp.example.com --smtp_port=25 \\\n --smtp_user=ajohnson --smtp_password=k1tt3ns [PATH_TO_YOUR_APP]\n\nReplace:\n\n- `[DEVAPPSERVER_ROOT]` with the path to the folder where you extract the [archived version](#before_you_begin) of `devapp_server.py`.\n- `--smtp_host`, `--smtp_port`, `--smtp_user` and `--smtp_password` options with your own configuration values.\n\nUsing Sendmail\n\n\nTo enable mail support with Sendmail, invoke `dev_appserver.py` as follows: \n\n python2 [DEVAPPSERVER_ROOT]/google_appengine/dev_appserver.py --enable_sendmail=yes [PATH_TO_YOUR_APP]\n\nReplace `[DEVAPPSERVER_ROOT]` with the path to the folder where you where you\nextract the [archived version](#before_you_begin) of `devapp_server.py`.\n\nThe local server will use the `sendmail` command to send email messages with\nyour installation's default configuration.\n| **Note:** If you don't invoke `dev_appserver.py` with either SMTP or Sendmail as described, then attempts to send email from your application will do nothing, but the attempt will appear successful in your application.\n\nUse URL Fetch\n\nWhen your application uses the URL fetch API to make an HTTP request, the\nlocal development server makes the request directly from your computer. The\nURL Fetch behavior on the local server may differ from production\nApp Engine if you use a proxy server for accessing websites.\n\nDebug locally with XDebug\n\nIf you have a debugger that is compatible with the\n[XDebug debugger](http://xdebug.org/), and you have the `xdebug` module\ninstalled, you can use XDebug with the local development server.\n\nTo enable XDebug on the Development Server on Linux or macOS:\n\n1. Export the `XDEBUG_CONFIG` environment variable with an idekey for your IDE to\n connect to\n\n export XDEBUG_CONFIG=\"idekey=netbeans-xdebug remote_host=localhost\"\n\n2. Invoke the Development Server with `--php_remote_debugging=yes`"]]