Single PC with Remote Debug

 
Step 1: Install xDebug in remote web server. 
Step 2: Modify xdebug.ini (or php.ini)

Step 3: Setup PHPStorm
  1. setup File -> Settings -> Languages & Frameworks -> PHP -> CLI Interpreter -> ... -> + from Docker (one project should be Frontend, one project is Backend, they are separate.)
  2. setup File -> Settings -> Languages & Frameworks -> PHP -> Debug. You need to change the Debug port to 9001 ; (For Backend project, set it to 9002)
  3. setup File -> Settings -> Languages & Frameworks -> PHP -> Servers.  Specify a Name for the server, and give the host address. In my case, the remote server is 127.0.0.1
Step 4: Install a debug plugin in browser
  1. Install  Debugger Plugin , before test anything in browser, turn it on. So XDEBUG_SESSION_START=1 will be triggered, the web server will notify php’s xdebug to handler the incoming request.
Step 5: Turn on the debug listener in PHPStorm.

 

Multiple PCs with Remote Debug

 

Steps are very similar to Single PC with Remote Debug section. So I list out different steps only.

Step 1: Install Komodo Remote Debugging on remote server (http://code.activestate.com/komodo/remotedebugging/) 
  1. To make sure remote web server can connect to DBGp Proxy.
  2. Launch pydbgpproxy on server, and see:

Step 2: Modify xdebug.ini (php.ini)

Step 3: Setup PHPStorm
  1. setup Server (Same as above)
  2. setup Debug 
    1. The debug port is up to yourself. It does not matter now, as long as this port is not occupied in local PC.
  3. setup DBGP
    1. path: File -> Settings -> Languages & Frameworks -> PHP -> Debug -> DBGp Proxy
    2. IDE key: Any IDE key is OK. But do NOT duplicate with other PCs’.
    3. Host: the DBGp Proxy Server’s IP. INFO: dbgp.proxy: dbgp listener on 127.0.0.1:9000, so it should be 127.0.0.1
    4. Port: the port between DBGp and PHPStorm. INFO: dbgp.proxy: IDE listener on 0.0.0.0:9001, so it should be 9001.
  4. register DBGP: Tools -> DBGp Proxy -> Register IDE
Step 4: Turn on listener (the green phone in IDE tool bar). 

 

PHP CLI with Remote Server

After the tutorials above, PHP CLI debug is relatively quite easier. Just need to export XDBUG_CONFIG to Terminal/CMD, then it works.

For Linux

For Windows