[[["わかりやすい","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`"]]