PhpStorm+Docker Dev
Last updated
Was this helpful?
Last updated
Was this helpful?
FROM php:7.2-fpm
# ...
RUN pecl install xdebug
This is Xdebug 2.x version settings:
[XDebug]
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20170718/xdebug.so
xdebug.remote_connect_back=0
xdebug.remote_host=host.docker.internal
xdebug.remote_port=9000
xdebug.idekey=PHPSTORM
xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.cli_color=1
xdebug.profiler_enable=0
xdebug.profiler_output_dir="~/xdebug/phpstorm/tmp/profiling"
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_log="/var/www/xdebug_log/xdebug_docker.log"
This is Xdebug 3.x version settings:
[XDebug]
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20170718/xdebug.so
xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.idekey=PHPSTORM
xdebug.client_host=host.docker.internal
xdebug.remote_handler=dbgp
xdebug.client_port=9000
;xdebug.remote_connect_back=0
;xdebug.cli_color=1
;xdebug.profiler_enable=0
should expose a correct port EXPOSE 8080
services:
php-fpm:
container_name: php-fpm
build: ./docker-config/php
restart: unless-stopped
tty: true
volumes:
- ./src:/var/www
- ./docker-config/php/php.ini:/usr/local/etc/php/php.ini
working_dir: /var/www
ports:
- '9091:9000'
environment:
XDEBUG_CONFIG: "remote_host=host.docker.internal"
PHP_IDE_CONFIG: "serverName=api_logix_crm-docker"
PHP interpreter
Language&Frameworks->PHP->Servers
docker-compose up,
set breakpoint, click "Start Listening to PHP Debug Connection", access web application or call api, see if it works.