PHP Info

Get PHP info

Explore further

For detailed documentation that includes this code sample, see the following:

Code sample

PHP

To authenticate to Cloud Functions, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.


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 '';
}

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser.