use Psr\Http\Message\ServerRequestInterface;
function phpInfoDemo(ServerRequestInterface $request): string
{
// phpinfo() displays its output directly in the function's
// HTTP response, so we don't need to explicitly return it
//
// Note: we recommend deleting the deployed Cloud Function once you no
// longer need it, as phpinfo() may broadcast potential security issues.
phpinfo();
return '';
}
[[["わかりやすい","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-05 UTC。"],[[["\u003cp\u003eCloud Run functions use \u003ccode\u003enginx\u003c/code\u003e and \u003ccode\u003ePHP-FPM\u003c/code\u003e to serve requests and run in an environment defined by the language version, known as the runtime.\u003c/p\u003e\n"],["\u003cp\u003eYou can select the preferred PHP runtime version for your function during deployment, with several versions supported and listed on the Runtime support page.\u003c/p\u003e\n"],["\u003cp\u003eFunctions can be deployed using the Google Cloud CLI with the \u003ccode\u003e--runtime\u003c/code\u003e parameter, or through the Google Cloud console.\u003c/p\u003e\n"],["\u003cp\u003ePHP functions can be prepared locally or directly in the Google Cloud console, and use the PHP Functions Framework library.\u003c/p\u003e\n"],["\u003cp\u003eDependencies for your PHP function are specified in a \u003ccode\u003ecomposer.json\u003c/code\u003e file, and configurations can be managed via a \u003ccode\u003ephp.ini\u003c/code\u003e file in the root directory.\u003c/p\u003e\n"]]],[],null,["# The PHP Runtime\n===============\n\nYour Cloud Run function runs in an environment consisting of an operating\nsystem version plus add-on packages, language support, and\nthe Functions Framework library that supports and invokes your function.\nThis environment is identified by the language version, and is known as the\nruntime.\n\nThese runtimes use `nginx` and `PHP-FPM` to serve requests. To learn more\nabout runtimes in general, and to learn which Ubuntu version each PHP runtime\nuses, see the [Cloud Run functions execution\nenvironment](/functions/1stgendocs/concepts/execution-environment#php).\n\nSelect your runtime\n-------------------\n\nCloud Run functions supports several versions of PHP, listed on the\n[Runtime support](/functions/1stgendocs/runtime-support#php) page. You can\nselect the preferred PHP runtime for your function during deployment. \n\n### gcloud\n\nIf you're using the Google Cloud CLI, specify the runtime\nby using the `--runtime` parameter. \u003cvar translate=\"no\"\u003eNAME\u003c/var\u003e specifies the\nfunction name. For example: \n\n```bash\ngcloud functions deploy NAME --no-gen2 --runtime php82 --trigger-http\n```\n\nFor more deployment parameters, see [Deploy a Cloud Run function](/functions/1stgendocs/deploy#basics).\n\n### Console\n\nIf you're using the Google Cloud console, see the [Google Cloud console\nquickstart](/functions/1stgendocs/console-quickstart-1st-gen) for\ndetailed instructions.\n\nFunction preparation\n--------------------\n\nYou can prepare a function directly from the Google Cloud console or write it on\nyour local machine and upload it. To prepare your local machine for PHP\ndevelopment, see [Using PHP on Google Cloud](/php/docs).\n\nThe library that invokes your function is the [PHP Functions\nFramework](https://github.com/GoogleCloudPlatform/functions-framework-php).\n| **Note:** The only type of [event-driven functions](/functions/1stgendocs/writing#types_of_cloud_functions) PHP supports are [CloudEvent functions](/functions/1stgendocs/writing#cloudevent_functions).\n\nSource code structure\n---------------------\n\nFor Cloud Run functions to find your function's definition, your\nsource code must follow a specific structure. See\n[Writing Cloud Run functions](/functions/1stgendocs/writing#structuring_source_code)\nfor more information.\n\nPHP Configuration\n-----------------\n\nYou configure your PHP function with a [`php.ini`\nfile](https://www.php.net/manual/en/configuration.file.php) in your function's\nroot directory. You can view existing PHP configuration settings with the\n[`phpinfo()`](https://www.php.net/manual/en/function.phpinfo.php) function as\nshown in the following code sample: \n\n \n use Psr\\Http\\Message\\ServerRequestInterface;\n\n function phpInfoDemo(ServerRequestInterface $request): string\n {\n // phpinfo() displays its output directly in the function's\n // HTTP response, so we don't need to explicitly return it\n //\n // Note: we recommend deleting the deployed Cloud Function once you no\n // longer need it, as phpinfo() may broadcast potential security issues.\n phpinfo();\n return '';\n }\n\nSpecifying dependencies\n-----------------------\n\nYou specify dependencies for your function by adding them to a project file\ncalled `composer.json`. For more information, see [Specifying dependencies in\nPHP](/functions/1stgendocs/writing/specifying-dependencies-php)."]]