author: Michał Powała
source repository: Docker-PhpCli
This repository contains running PHP CLI docker image with slightly extended official php imgage. It's extended with configured xDebug extension and installed Composer.
- 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:
/code
- 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