author: Michał Powała
source repository: docker-php-cli-xdebug
This repository contains running PHP CLI docker image with slightly extended official php imgage. It's extended with configured xDebug extension and installed Composer. The repostory is useful as basic image for any PHP application. Use Composer to download needed dependencies, libraries or PHP frameworks like Symfony.
- Install Docker: OFFICIAL INSTRUCTION
- Install Compose: OFFICIAL INSTRUCTION
- Change directory to dir you cloned the repo and type:
docker-compose up -d
- Enter the container:
docker-compose exec cli bash
- Turn on and turn off debugging mode with:
xdebugstart
andxdebugstop
- Run your script with: php your_script.php
- Go to options
- Go to Languages & Frameworks > PHP > Debug
- Scroll down to "Xdebug" section
- Make sure:
- Debug port is set to:
9000
- Can accept external connections is set to:
checked
- Debug port is set to:
- Go to Languages & Frameworks > PHP > Servers and set up:
- Name:
docker-xdebug-server
- Host: does not matter
- Port: does not matter
- Debugger:
Xdebug
- Use path mappings:
checked
- Absolute path on the server:
/volume
- Name:
DON'T FORGET: to start listening for PHP Debug connections in the IDE:
Inside docker container type (via bash):
- To turn on:
xdebugstart
- To turn off:
xdebugstop