Skip to content

Latest commit

 

History

History
executable file
·
38 lines (31 loc) · 1.91 KB

README.md

File metadata and controls

executable file
·
38 lines (31 loc) · 1.91 KB

author: Michał Powała
source repository: docker-php-cli-xdebug

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.

HOW TO USE IT

  1. Install Docker: OFFICIAL INSTRUCTION
  2. Install Compose: OFFICIAL INSTRUCTION
  3. Change directory to dir you cloned the repo and type: docker-compose up -d
  4. Enter the container: docker-compose exec cli bash
  5. Turn on and turn off debugging mode with: xdebugstart and xdebugstop
  6. Run your script with: php your_script.php

HOW TO SET UP YOUR PHPSTORM IDE

  1. Go to options
  2. Go to Languages & Frameworks > PHP > Debug
  3. Scroll down to "Xdebug" section
  4. Make sure:
    • Debug port is set to: 9000
    • Can accept external connections is set to: checked
  5. 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

DON'T FORGET: to start listening for PHP Debug connections in the IDE:
Start Listening for PHP Debug connections picture

HOW TO TURN ON AND TURN OFF XDEBUG SESSION

Inside docker container type (via bash):

  • To turn on: xdebugstart
  • To turn off: xdebugstop