PhpStorm and xdebug in the browser - the missing instruction

I spent the usual two lifetimes getting xdebug working (again) after upgrading to a new major version of phpStorm. Finally, I could debug a standalone php script in the IDE, but all attempts to do so from the browser were fruitless.

It turns out that phpStorm and the browser were using different versions of php.

Things to do (note that I am using Macports):

  1. Run phpinfo() from the browser and from within phpStorm and see if the versions are different.
  2. If they are, make sure you have the apache handler for the version you want to run in the browser. So, if it's php 5.5:

    port installed php55*

    should yield a list that includes php55-apache2handler. If not, install it:

    port install php55-apache2handler

    You should now see it listed when doing the 'port installed'

  3. Ensure that apache is loading the correct module for the version of php.
    • Edit /opt/local/apache2/conf/httpd.conf
    • Find

      LoadModule modules/mod_php<wrong version>.so and change it to the correct version

    • Restart apache

Add new comment


  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd>
  • Missing filter. All text is removed
CAPTCHA This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.