Skip to content

Commit

Permalink
Add xdebug to make_php, vscode xdebug launch prof
Browse files Browse the repository at this point in the history
Add vscode xdebug extension to .devcontainer.json
  • Loading branch information
kasbohm committed May 24, 2024
1 parent d4428c6 commit 88c30ab
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 2 deletions.
9 changes: 8 additions & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@
// "extensionsExtra": "xdebug redis"
// }
},

"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"xdebug.php-debug"
]
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// This can be used to network with other containers or the host.
// "forwardPorts": [5000, 5432],
Expand Down
48 changes: 48 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"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}",
"port": 9003,
"serverReadyAction": {
"pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
"uriFormat": "http://localhost:%s",
"action": "openExternally"
}
}
]
}
18 changes: 17 additions & 1 deletion 3rdparty/make_php.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LIBVER_php := 7.4.6
php_download: download/php-${LIBVER_php}.tar.gz

.PHONY: php_build
php_build: php/bin/php-cgi
php_build: php/bin/php-cgi php/lib/php/extensions/no-debug-non-zts-20190902/xdebug.so

.PHONY: php_clean
php_clean:
Expand All @@ -31,3 +31,19 @@ php/bin/php-cgi: download/php-${LIBVER_php}.tar.gz | postgresql_build
$(MAKE) -C php_build/php-$(LIBVER_php)
$(MAKE) -C php_build/php-$(LIBVER_php) install
$(RM) -r php_build

# Change xdebug version if updating php version (https://xdebug.org/wizard)
download/xdebug-3.1.6.tgz:
mkdir -p download/
cd download && wget https://xdebug.org/files/xdebug-3.1.6.tgz

php/lib/php/extensions/no-debug-non-zts-20190902/xdebug.so: php/bin/php-cgi download/xdebug-3.1.6.tgz
mkdir -p $(BASEDIR)/php_xdebug_build \
&& cd $(BASEDIR)/php_xdebug_build \
&& tar xf $(BASEDIR)/download/xdebug-3.1.6.tgz \
&& cd $(BASEDIR)/php_xdebug_build/xdebug-3.1.6 \
&& $(BASEDIR)/php/bin/phpize \
&& ./configure --with-php-config=$(BASEDIR)/php/bin/php-config
$(MAKE) -C $(BASEDIR)/php_xdebug_build/xdebug-3.1.6
cp $(BASEDIR)/php_xdebug_build/xdebug-3.1.6/modules/xdebug.so $(BASEDIR)/php/lib/php/extensions/no-debug-non-zts-20190902/
$(RM) -r $(BASEDIR)/php_xdebug_build

0 comments on commit 88c30ab

Please sign in to comment.