ARTICLE AD BOX
Asked today
Viewed 32 times
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.
671 silver badge10 bronze badges
Try with these settings:
Edit your php.ini
zend_extension=xdebug [xdebug] xdebug.mode=debug xdebug.start_with_request=yes xdebug.client_host=127.0.0.1 xdebug.client_port=9003 xdebug.log_level=0Restart your terminal after changes.
Create .vscode/launch.json.
{ "version": "0.2.0", "configurations": [ { "name": "Listen for Xdebug", "type": "php", "request": "launch", "port": 9003, "pathMappings": { "/workspace": "${workspaceFolder}" } } ] }Then test.
Explore related questions
See similar questions with these tags.
