Step 4 – Test LocalWP and JetBrains with Xdebug


Prerequisite

You are working through Step Debugging PHP on Your Personal Computer.

✅ Installed Chrome web browser.
✅ Installed Xdebug Chrome Extension in your Chrome web browser.
✅ Installed WPEngine LocalWP 9.x (Lightning) application.
✅ Installed JetBrains IntelliJ IDEA 2022.x with PHP plugin; or PHP Storm is working.

✅ Ensured LocalWP has a ‘Local Site’. Use [Add a Local Site] button or Import/Export.
✅ Ensured LocalWP -> ‘Local Sites’ -> ‘{LocalWebsite}’ has ‘Xdebug’ option turned ‘On’.
✅ Ensured LocalWP -> ‘Local Sites’ -> ‘{LocalWebsite}’ is alive. Use [Start Site] button.
✅ Ensured Chrome web browser can show the ‘{LocalWebsite}’. Use [Open Site] button.


Test Incoming PHP Debug Connection to JetBrains IntelliJ

Objective: To confirm that a local website, running on your personal computer, is successfully talking with the JetBrains IntelliJ application using the web browser … so we can step debug PHP code.

Hint: Written for WPEngine LocalWP 9.x (Lightning).

Hint: Written for JetBrains IntelliJ IDEA 2022.x (Ultimate Edition).

  1. Close JetBrains IntelliJ application.
  2. Close LocalWP application.
  3. Start LocalWP application.
    • Navigate to ‘Local Sites’ -> ‘{LocalWebsite}’.
    • Click ‘Start Site’ button.
      • Hint: The local website server services will be started.
    • Click ‘Open Site’ button.
      • Hint: The system default webbrowser should load and show the home page, running as a local website, from your personal computer.
  4. Start JetBrains IntelliJ application.
    • Open a new blank project.
      • Hint: It is temporary and only required for this test.
    • Navigate to ‘Run’ menu -> ‘Start Listening for PHP Debug Connections’.
      • Hint: You know this worked because the menu item now says ‘Stop Listening for PHP Debug Connections’.
  5. Switch to the webbrowser.
    • Navigate to tab with the local website home page.
    • Click ‘Reload Page’ button.
      • Hint: The webbrowser tab will show a spinning icon while it waits for the local website to deliver the home page content.
      • Hint: After a while, the page might fail to load and show a ‘504 Gateway Timeoout’ error. This is ok. Repeat this step to start a new debug session.
    • A new ‘Incoming Connection from Xdebug’ popup window should be showing in the JetBrains IntelliJ application.
    • Success … the the JetBrains IntelliJ application has recieved a PHP Xdebug session trigger.
      • Hint: We have now confirmed that a local website, running on your personal computer, is successfully talking with the JetBrains IntelliJ application using the web browser … this is the beginning of a PHP debud session.
      • Hint: Notice that the JetBrains IntelliJ applications new ‘Incoming Connection from Xdebug’ popup window is asking to ‘Configure Local File Path’. It is asking where to find a copy of the source code that matches the PHP debug session. We are using a new blank project for these test instructions, to make this important missing configuration next-step, really obvious.
      • Hint: For now, we will stop here. The objective was to test that all the puzzle pieces for a local machine PHP debug session are connecting and talking with each other.
    • Click ‘Ignore’ button.
  6. Switch to JetBrains IntelliJ application.
    • Close the new blank project, without saving.
    • Close JetBrains IntelliJ application.
  7. Switch to LocalWP application.
    • Navigate to ‘Local Sites’ -> ‘{LocalWebsite}’.
    • Click ‘Stop Site’ button.
      • Hint: The local website server services will shutdown.
    • Close LocalWP application.
  8. Done.