Debugging Web Applications In PHPStorm With Xdebug And Docker

From Littledamien Wiki
Revision as of 12:15, 10 May 2018 by Video8 (talk | contribs) (Created page with "== Overview == How to debug a PHP web application in PHPStorm using Docker and XDebug. <ref>[https://serversforhackers.com/c/getting-xdebug-working Getting xDebug to Work] -...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Overview

How to debug a PHP web application in PHPStorm using Docker and XDebug. [1] [2]

PHP Configuration

Preferences > Language & Frameworks > PHP > Servers

Click the "plus" icon to create a new server.

  • Name: docker
  • Host: localhost
  • Port: 80
  • Debugger: Xdebug
  • Use path mappings: checked

Then under path mappings create associations between project files and their respective locations in the Docker container, e.g.:

The host and port reference host and port within the Docker container. This applies to the path mappings as well.

The container's HTML root is /var/www/html. This path may or may not exist on the local file system, but that doesn't impact anything here.

Two project file directories cannot point to the same path on the server (e.g. bfhhand_web and common_lib can't coexist in the same root directory as they do on production.)

See also