Skip to content

Commit 89e5c63

Browse files
feat: added support to Xdebug
1 parent a5631ef commit 89e5c63

File tree

6 files changed

+55
-13
lines changed

6 files changed

+55
-13
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# Ignore this folders
22
/db
3+
/wp-core
34
/themes
45
/plugins

.vscode/launch.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Listen for Xdebug",
9+
"type": "php",
10+
"request": "launch",
11+
"port": 9003,
12+
"pathMappings": {
13+
"/var/www/html": "${workspaceRoot}",
14+
},
15+
"log": true
16+
},
17+
{
18+
"name": "Launch currently open script",
19+
"type": "php",
20+
"request": "launch",
21+
"program": "${file}",
22+
"cwd": "${fileDirname}",
23+
"port": 9003,
24+
}
25+
]
26+
}

docker/Dockerfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
FROM wordpress
2-
RUN chown -R www-data:www-data /var/www/html
2+
3+
RUN chown -R www-data:www-data /var/www/html
4+
5+
RUN pecl install xdebug
6+
7+
RUN docker-php-ext-enable xdebug

docker/docker-compose.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ version: '3.9'
33
services:
44

55
db:
6-
76
image: mysql:5.7
87
restart: always
98
environment:
@@ -14,10 +13,7 @@ services:
1413
volumes:
1514
- ../db:/var/lib/mysql
1615

17-
18-
1916
phpmyadmin:
20-
2117
image: phpmyadmin/phpmyadmin:latest
2218
restart: always
2319
depends_on:
@@ -29,30 +25,26 @@ services:
2925
PMA_USER: ${MYSQL_USER}
3026
PMA_PASSWORD: ${MYSQL_PASSWORD}
3127

32-
33-
3428
wordpress:
35-
3629
build: .
3730
restart: always
3831
depends_on:
3932
- db
4033
ports:
4134
- ${WORDPRESS_PORT}:80
4235
environment:
36+
PHP_EXTENSION_XDEBUG: 1
4337
WORDPRESS_DB_HOST: db:3306
4438
WORDPRESS_DB_USER: ${MYSQL_USER}
4539
WORDPRESS_DB_PASSWORD: ${MYSQL_PASSWORD}
4640
WORDPRESS_DB_NAME: ${MYSQL_DATABASE_NAME}
4741
volumes:
42+
- ../wp-core:/var/www/html/
4843
- ../plugins:/var/www/html/wp-content/plugins
4944
- ../themes:/var/www/html/wp-content/themes
50-
51-
52-
45+
- ./xdebug.ini:/usr/local/etc/php/conf.d/xdebug.ini
5346

5447
wpcli:
55-
5648
image: wordpress:cli
5749
depends_on:
5850
- wordpress
@@ -66,4 +58,4 @@ services:
6658
WORDPRESS_DB_NAME: ${MYSQL_DATABASE_NAME}
6759
user: xfs
6860
entrypoint: wp
69-
command: bash -c '--info'
61+
command: --info

docker/error_reporting.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
error_reporting=E_ALL

docker/xdebug.ini

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
zend_extension=xdebug
2+
# Controls which Xdebug features are enabled
3+
#xdebug.mode=develop,debug
4+
xdebug.mode = debug
5+
xdebug.profiler_enable=1
6+
xdebug.remote_enable=1
7+
xdebug.remote_handler=dbgp
8+
#xdebug.remote_host=host.docker.internal
9+
# Tells Xdebug the IP addres or hostname of the machine that is running the IDE
10+
xdebug.client_host=host.docker.internal
11+
# Instructs Xdebug to always initiate a debugging session
12+
xdebug.start_with_request=yes
13+
xdebug.client_port = 9003
14+
#xdebug.log = /tmp/xdebug.log
15+
xdebug.remote_autostart= 1
16+
xdebug.remote_connect_back= 1
17+
xdebug.idekey=vsc

0 commit comments

Comments
 (0)