docker+nginx and xdebug
Hi.
I am running a docker container with nginx, php5 and php5-xdebug.
The container is run via
docker run -p 8001:80 -p 8443:443 -p 9001:9001 \
-v $DIR/src:/home/myuser/src:ro \
-v $DIR/www:/home/myuser/www:ro \
...
So I can access {projectroot}/www/test.php via https://localhost:8443/local/test.php
PHP Storm is also listening for PHP Debug connections (I clicked the button). With the built-in webserver I was able to successfully break on breakpoints.
However I can't seem to get xdebug (i.e. using breakpoints etc.) running using my docker setup.
phpinfo says:
PHP Version 5.6.40-0+deb8u12
Additional ini-files parsend: .../etc/php5/fpm/conf.d/20-xdebug.ini...
Contents of that file: zend_extension=xdebug.so
| xdebug Version 2.2.5 |
| Directive | Local Value | Master Value |
|---|---|---|
| xdebug.auto_trace | Off | Off |
| xdebug.cli_color | 0 | 0 |
| xdebug.collect_assignments | Off | Off |
| xdebug.collect_includes | On | On |
| xdebug.collect_params | 0 | 0 |
| xdebug.collect_return | Off | Off |
| xdebug.collect_vars | Off | Off |
| xdebug.coverage_enable | On | On |
| xdebug.default_enable | On | On |
| xdebug.dump.COOKIE | no value | no value |
| xdebug.dump.ENV | no value | no value |
| xdebug.dump.FILES | no value | no value |
| xdebug.dump.GET | no value | no value |
| xdebug.dump.POST | no value | no value |
| xdebug.dump.REQUEST | no value | no value |
| xdebug.dump.SERVER | no value | no value |
| xdebug.dump.SESSION | no value | no value |
| xdebug.dump_globals | On | On |
| xdebug.dump_once | On | On |
| xdebug.dump_undefined | Off | Off |
| xdebug.extended_info | On | On |
| xdebug.file_link_format | no value | no value |
| xdebug.idekey | no value | no value |
| xdebug.max_nesting_level | 100 | 100 |
| xdebug.overload_var_dump | On | On |
| xdebug.profiler_aggregate | Off | Off |
| xdebug.profiler_append | Off | Off |
| xdebug.profiler_enable | Off | Off |
| xdebug.profiler_enable_trigger | On | On |
| xdebug.profiler_output_dir | /home/mbweb/tmp/profiles | /home/mbweb/tmp/profiles |
| xdebug.profiler_output_name | cachegrind.out.%p | cachegrind.out.%p |
| xdebug.remote_autostart | Off | Off |
| xdebug.remote_connect_back | Off | Off |
| xdebug.remote_cookie_expire_time | 3600 | 3600 |
| xdebug.remote_enable | Off | Off |
| xdebug.remote_handler | dbgp | dbgp |
| xdebug.remote_host | localhost | localhost |
| xdebug.remote_log | no value | no value |
| xdebug.remote_mode | req | req |
| xdebug.remote_port | 9000 | 9000 |
| xdebug.scream | Off | Off |
| xdebug.show_exception_trace | Off | Off |
| xdebug.show_local_vars | Off | Off |
| xdebug.show_mem_delta | Off | Off |
| xdebug.trace_enable_trigger | Off | Off |
| xdebug.trace_format | 0 | 0 |
| xdebug.trace_options | 0 | 0 |
| xdebug.trace_output_dir | /tmp | /tmp |
| xdebug.trace_output_name | trace.%c | trace.%c |
| xdebug.var_display_max_children | 128 | 128 |
| xdebug.var_display_max_data | 512 | 512 |
| xdebug.var_display_max_depth | 3 | 3 |
I also tried Validate Debugger Configuration on Web Server:
[x] Local Web Server or Shared Folder
Path to create validation script: /home/foo/bar/www/
Url to validation script: https://localhost:8443/local/
Specified URL is not reachable, caused by: 'No name matching localhost found'
I can access https://localhost:8443/local/ with no problem in the browser (also have the xdebug extensions installed).
If I create a file /home/foo/bar/www/test.php, then I can access it via https://localhost:8443/local/test.php
In Settings > Tools > Server Certificates I have added the server certificates and also "Accept non-trusted certificates automatically" is checked.
Not sure what to do next, also bugs me, that I can't get "Web Server Debug Validation" to work.
Thanks for your time.
Please sign in to leave a comment.
First of all, I would enable "xdebug.remote_enable","xdebug.remote_autostart" options and set "xdebug.remote_host" to the "host.docker.internal" (if you are on macOS).
Also, does the PhpStorm listen on TCP 9000 in your scenario, right?