You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# docker-wordpress-wp-cli-xdebug (with tcpdump for debugging)
2
2
3
-
This is an image based off of [Conetix's docker-wordpress-wp-cli](https://github.com/conetix/docker-wordpress-wp-cli).
4
-
Forked from [Johnrom's docker-wordpress-wp-cli-xdebug](https://github.com/johnrom/docker-wordpress-wp-cli-xdebug). Thanks!
3
+
This is an image based off of [Conetix's docker-wordpress-wp-cli](https://github.com/conetix/docker-wordpress-wp-cli), forked from [Johnrom's docker-wordpress-wp-cli-xdebug](https://github.com/johnrom/docker-wordpress-wp-cli-xdebug), and then simplified. Roundabout, but thanks to all along the way!
5
4
6
-
This repository adds xDebug support.
5
+
This repository adds xDebug support to the WordPress container for Docker.
7
6
8
-
Additionally, I've removed an opcache configuration file that the WordPress image installs because it appeared to affect PHP Opcode Caching on my machine. You shouldn't notice a difference unless your local machine gets a lot of hits *lol*.
7
+
Additionally, it removes an opcache configuration file that the WordPress image installs because it appeared to affect PHP Opcode Caching on my machine. You shouldn't notice a difference unless your local machine gets a lot of hits,*lol*.
9
8
10
-
**This is super untested.** Do not use in production. I built this on Windows so permissions are not correct. Maybe one day I will fix it.
9
+
**This is super untested.** Do not use in production.
11
10
12
11
To use, you'll have to pass a variable to XDebug with your IP Address. Please note, this is the IP address of your machine, not the docker VM. It is generally a 192.168.\* address. You can find it a number of ways, usually it can be found somewhere in the `ifconfig` data.
13
12
@@ -22,59 +21,3 @@ wp_site:
22
21
environment:
23
22
XDEBUG_CONFIG: remote_host=192.168.1.100
24
23
```
25
-
26
-
If that worked, skip to "So what now?" Otherwise you can try the next idea, but I have not had luck with that yet.
27
-
28
-
---
29
-
30
-
Are you **not** the only one developing your project? Then we'll have to use the environment variable from each of your shells. So, replace the above with:
31
-
32
-
```
33
-
wp_site:
34
-
image: johnrom/docker-wordpress-wp-cli-xdebug
35
-
... [ your regular configuration ]
36
-
environment:
37
-
- XDEBUG_CONFIG
38
-
```
39
-
40
-
This means it will use whatever environment variable is in your shell when you run `docker-compose up -d`. Now go download the xdebug.sh file from this GitHub repo to your root docker directory. If your docker-machine is not named default, you should replace default with your machine's name in the `xdebug.sh` file.
41
-
42
-
Every time, before you run `docker-compose up -d`, run `eval $(./xdebug.sh)`**in the directory with `docker-compose.yml` in it**. Like so:
43
-
44
-
```
45
-
eval $(./xdebug.sh)
46
-
docker-compose up -d
47
-
```
48
-
49
-
This tiny command runs the `docker-machine ip | sed` command above and exports it to an environment variable, that docker-compose picks up.
50
-
51
-
To confirm everything is working, make a phpinfo.php with `<?php phpinfo(); ?>` and check the variables for XDebug -- "remote_host" should show your IP address.
52
-
53
-
## So what now?
54
-
55
-
Now, PHP will query your host machine on port 9000 every time you make a request. You'll have to set up an xdebug debugger in your editor of choice. I'm currently using VS Code so I haven't verified any others' tutorials. Set breakpoints, test listening for notices, etc. It should all magically work.
56
-
57
-
-[VS Code](https://github.com/felixfbecker/vscode-php-debug) - skip *Install XDebug*, go to Configuration, and make sure to set localSourceRoot and serverSourceRoot
0 commit comments