Skip to content

Commit 4806bf0

Browse files
authored
Merge pull request #1 from strayobject/xdebugv3php7.4
feat: Updated to php7.4 + xdebug3
2 parents f497cbb + c01b32f commit 4806bf0

6 files changed

Lines changed: 21 additions & 9 deletions

File tree

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,20 @@ Flip between non xdebug local dev (much fast) to xdebug local dev (not fast but
33

44
Setup
55

6+
Full guide available at https://strayobject.medium.com/php-docker-and-xdebug-v3-with-no-performance-loss-9d0f49ac53ba
7+
68
1. Create a docker network:
79
`docker network create --subnet=192.168.50.0/24 pxd-docker`
810
2. Add `127.0.0.1 php-xdebug-docker` to your hosts file.
911
3. Run `docker-compose up -d` to start the env
12+
4. Open index.php in editor and add a breakpoint on line 6
13+
5. Open your browser, set up the plugin from the list: https://www.jetbrains.com/help/phpstorm/browser-debugging-extensions.html
14+
6. In browser navigate to http://php-xdebug-docker and turn on the extension.
15+
7. Reload the page (breakpoint should be triggered in the code editor)
16+
17+
Note: To see the breakpoint triggered via cli, you need to execute your commands in the app_xdebug container.
18+
19+
`docker-compose exec app_xdebug php index.php`
20+
21+
22+
Enjoy!

docker/app/.env

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
PHP_XDEBUG_ENABLED=1
2-
PHP_XDEBUG_REMOTE_PORT=9002
2+
#PHP_XDEBUG_REMOTE_PORT=9002
33
# Xdebug remote host likely 192.168.50.1 if on linux, use host.docker.internal on a Mac
44
PHP_XDEBUG_REMOTE_HOST=192.168.50.1
55
PHP_XDEBUG_IDKEY=pxd
66
PHP_MEMORY_LIMIT=1G
77

8-
APP_ENV=dev
98
PHP_IDE_CONFIG="serverName=pxd"

docker/app/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM php:7.3-fpm
1+
FROM php:7.4-fpm
22

33
ARG USER_ID
44
ARG GROUP_ID

docker/app/Dockerfile_xdebug

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM php:7.3-fpm
1+
FROM php:7.4-fpm
22

33
ARG USER_ID
44
ARG GROUP_ID

docker/app/php/xdebug.ini

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
xdebug.default_enable=${PHP_XDEBUG_ENABLED}
33
xdebug.max_nesting_level=256
44

5-
xdebug.remote_enable=1
6-
xdebug.remote_autostart=1
7-
xdebug.remote_host=${PHP_XDEBUG_REMOTE_HOST}
8-
xdebug.remote_port=${PHP_XDEBUG_REMOTE_PORT}
5+
xdebug.start_with_request=yes
6+
xdebug.mode=debug
97
xdebug.idekey=${PHP_XDEBUG_IDKEY}
8+
xdebug.client_host=${PHP_XDEBUG_REMOTE_HOST}
9+
#xdebug.client_port=${PHP_XDEBUG_REMOTE_PORT}

docker/nginx/nginx.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ resolver 127.0.0.11;
44
# idea from https://github.com/developersalliance/magento2-dockergento/blob/master/config/dockergento/nginx/conf/default.conf
55
map $cookie_XDEBUG_SESSION $fastcgi_pass {
66
default app;
7-
wordpress app_xdebug;
7+
pxd app_xdebug;
88
}
99

1010
server {

0 commit comments

Comments
 (0)