After I switched from Docker Machine to Docker for Mac, xdebug stopped working for me. The problem is that port 9000 on the host is not accessible from the container.
Xdebug configuration:
xdebug.remote_enable=1 xdebug.remote_port=9000 xdebug.remote_host=172.18.0.1 xdebug.idekey=PHPSTORM In the logs the following:
I: Checking remote connect back address. I: Checking header 'HTTP_X_FORWARDED_FOR'. I: Checking header 'REMOTE_ADDR'. I: Remote address found, connecting to 172.18.0.1:9000. E: Could not connect to client. :-( The container in which xdebug is installed is launched using Docker Compose
docker-compose.yml :
version: '2' services: php: image: <image with php and xdebug> ports: - 80:80 # - 9000:9000 volumes: - .:/var/www/html - ./php.ini:/usr/local/etc/php/conf.d/php.ini - ./xdebug.ini:/usr/local/etc/php/conf.d/xdebug.ini