How can I debug my php cloud function in vscode
18:12 23 Jan 2026

I have a php cloud [run] function that I would like to be able to debug but cannot for the life of me figure out how.

I can run it locally with composer run start and then I can trigger the main function using curl , passing in my payload.

My composer.json is:

{
    "require": {
        "psr/http-message": "^1.0",
        "google/cloud-functions-framework": "^1.1"
    },
    "scripts": {
        "start": [
            "Composer\\Config::disableProcessTimeout",
            "@putenv FUNCTION_SOURCE=index.php",
            "@putenv FUNCTION_TARGET=main",
            "php -S localhost:8080 -d display_errors=on vendor/bin/router.php"
         ]
     }
}

I have tried following this: https://dev.to/phpcontrols/debugging-php-with-vscode-and-xdebug-a-step-by-step-guide-4296 but when I try to run the debug for the local script it just does nothing and ends immediately.

php google-cloud-functions composer-php vscode-debugger