Last active
November 9, 2022 20:49
-
-
Save mdevoldere/3b7e20d4b996a6a21b2e66294de7185c to your computer and use it in GitHub Desktop.
PHP8 XDEBUG VSCode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"name": "Listen for Xdebug", | |
"type": "php", | |
"request": "launch", | |
"port": 9003 | |
}, | |
{ | |
"name": "Launch currently open script", | |
"type": "php", | |
"request": "launch", | |
"program": "${file}", | |
"cwd": "${fileDirname}", | |
"port": 0, | |
"runtimeArgs": [ | |
"-dxdebug.start_with_request=yes" | |
], | |
"env": { | |
"XDEBUG_MODE": "debug,develop", | |
"XDEBUG_CONFIG": "client_port=${port}" | |
} | |
}, | |
{ | |
"name": "Launch Built-in web server", | |
"type": "php", | |
"request": "launch", | |
"runtimeArgs": [ | |
"-dxdebug.mode=debug", | |
"-dxdebug.start_with_request=yes", | |
"-S", | |
"localhost:0" | |
], | |
"program": "", | |
"cwd": "${workspaceRoot}/www/", | |
"port": 9003, | |
"serverReadyAction": { | |
"pattern": "Development Server \\(http://localhost:([0-9]+)\\) started", | |
"uriFormat": "http://localhost:%s", | |
"action": "openExternally" | |
} | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. Open terminal and type "php -i > phpinfo.txt" | |
# 2. Copy all content from phpinfo.txt | |
# 3. Go to https://xdebug.org/wizard | |
# 4. Paste copied content in the wizard form and submit it | |
# 5. Follow instructions to download & rename xdebug | |
# 6. Put these lines at the end of your "php.ini" file | |
zend_extension = xdebug | |
[XDebug] | |
xdebug.remote_enable = 1 | |
xdebug.remote_autostart = 1 | |
xdebug.remote_host=localhost | |
xdebug.remote_port=9000 | |
# 7. Open your project folder with Visual Studio Code | |
# 8. Create ".vscode/launch.json" file | |
# 9. Paste the contents of the launch.json file provided in this gist | |
# 10. Adapt the directory of the "cwd" attribute to match your PHP project launch folder. | |
# 11. Go to VSCode Debug | |
# 12. Select "launch built-in web server" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment