Skip to content

Commit 630c9b5

Browse files
authored
Update README.md
1 parent 4f27baf commit 630c9b5

File tree

1 file changed

+4
-61
lines changed

1 file changed

+4
-61
lines changed

README.md

Lines changed: 4 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
# docker-wordpress-wp-cli-xdebug (with tcpdump for debugging)
22

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!
54

6-
This repository adds xDebug support.
5+
This repository adds xDebug support to the WordPress container for Docker.
76

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*.
98

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.
1110

1211
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.
1312

@@ -22,59 +21,3 @@ wp_site:
2221
environment:
2322
XDEBUG_CONFIG: remote_host=192.168.1.100
2423
```
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
58-
- [Sublime](https://github.com/martomo/SublimeTextXdebug) - **unverified**
59-
- [Atom](https://atom.io/packages/php-debug) - **unverified, but official**
60-
- [Brackets](https://github.com/spocke/php-debugger) - **unverified**, don't use "idekey"
61-
62-
### If that wasn't enough
63-
64-
Here's my launch.json for every project in VS Code for demonstrative purposes:
65-
66-
```
67-
{
68-
"version": "0.2.0",
69-
"configurations": [
70-
{
71-
"name": "Listen for XDebug",
72-
"type": "php",
73-
"request": "launch",
74-
"port": 9000,
75-
"localSourceRoot": "${workspaceRoot}/html",
76-
"serverSourceRoot": "/var/www/html"
77-
}
78-
]
79-
}
80-
```

0 commit comments

Comments
 (0)