PHPStorm not connecting to xdebug

I had xdebug working with PHPStorm ok.  I have not used it for a few weeks and when I tried to debug a file yesterday the debug window returned "Connection with 'xdebug' was not established. Validate      installation."  When I validated the installation I get "'xdebug' extension is not installed. Show phpinfo."

When I run phpinfo.php the output clearly states that xdebug IS installed.  This has been confirmed by running the wizard on xdebug.org against my phpinfo which outputs

Summary

  • Xdebug installed: 2.1.0
  • Server API: Apache 2.0 Handler
  • Windows: no
  • Zend Server: no
  • PHP Version: 5.3.6
  • Zend API nr: 220090626
  • PHP API nr: 20090626
  • Debug Build: no
  • Thread Safe Build: no
  • Configuration File Path: /Applications/MAMP/bin/php/php5.3.6/conf
  • Configuration File: /Library/Application Support/appsolute/MAMP PRO/conf/php.ini
  • Extensions directory: /Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626


  • I am running
    • OSX Mountain Lion
    • PHPStorm 5.0.4
    • MAMP PRO 2.0.5


    I have spent a day on this so far trying to figure it out but not making any progress.  Any help or ideas would be appreciated.

    Thanks
    John

    7 comments

    Hi John,

    1) Try upgrading xdebug to the latest stable version: 2.2.1

    2) Check firewall -- xdebug is the one that initiates connection to IDE, not other way around. If you are behind the router (e.g. server is on Internet), then you will have to do port forwarding on your router).

    3) Are you running it on the same computer as PhpStorm (I mean -- not in virtual environment) ?

    4) Would be good to see your xdebug settings from php.ini (or whatever file is used there) as well as output from phpinfo() (header one and xdebug specific section)

    Some useful links (in case you have not seen them yet):

    0

    Thanks Andriy for your prompt response.

    Thanks for the links - I will take a look.  I have read lots of material on the web, but not sure I have seen these, thanks.

    I have all of this configured locally so the firewall should not be the issue here I think.

    I will try the xdebug upgrade.

    The php.ini file entries are as follows:

    [xdebug]
    zend_extension= "/Applications/MAMP/bin/php/php5.3.6/lib/php/extensions/no-debug-non-zts-20090626/xdebug.so"
    xdebug.remote_enable=1
    xdebug.remote_host=localhost
    xdebug.remote_port=9000
    xdebug.remote_handler=dbgp


    Initially I only had the first two lines but added the others following research on the web, but that has not affected anything.

    phpinfo - as follows:

    Build Date Sep 15 2011 11:18:57
    Configure Command './configure'   '--with-mysql=/Applications/MAMP/Library'  '--with-apxs2=/Applications/MAMP/Library/bin/apxs' '--with-gd'  '--with-jpeg-dir=/Applications/MAMP/Library'  '--with-png-dir=/Applications/MAMP/Library' '--with-zlib'  '--with-freetype-dir=/Applications/MAMP/Library'  '--prefix=/Applications/MAMP/bin/php/php5.3.6'  '--exec-prefix=/Applications/MAMP/bin/php/php5.3.6'  '--sysconfdir=/Applications/MAMP/bin/php/php5.3.6/conf' '--with-soap'  '--with-config-file-path=/Applications/MAMP/bin/php/php5.3.6/conf'  '--enable-track-vars' '--enable-bcmath' '--enable-ftp'  '--enable-gd-native-ttf' '--with-bz2=/usr' '--with-ldap'  '--with-mysqli=/Applications/MAMP/Library/bin/mysql_config'  '--with-sqlite' '--with-ttf' '--with-t1lib=/Applications/MAMP/Library'  '--enable-mbstring=all' '--with-curl=/Applications/MAMP/Library'  '--enable-dbx' '--enable-sockets' '--enable-bcmath'  '--with-imap=shared,/Applications/MAMP/Library/lib/imap-2007e'  '--enable-soap' '--with-kerberos' '--enable-calendar'  '--with-pgsql=shared,/Applications/MAMP/Library/pg' '--enable-dbase'  '--enable-exif' '--with-libxml-dir=/Applications/MAMP/Library'  '--with-gettext=shared,/Applications/MAMP/Library'  '--with-xsl=/Applications/MAMP/Library'  '--with-pdo-mysql=shared,/Applications/MAMP/Library'  '--with-pdo-pgsql=shared,/Applications/MAMP/Library/pg'  '--with-mcrypt=shared,/Applications/MAMP/Library' '--with-openssl'  '--enable-zip' '--with-iconv=/Applications/MAMP/Library'
    Server API Apache 2.0 Handler
    Virtual Directory Support disabled
    Configuration File (php.ini) Path /Applications/MAMP/bin/php/php5.3.6/conf
    Loaded Configuration File /Library/Application Support/appsolute/MAMP PRO/conf/php.ini
    Scan this dir for additional .ini files (none)
    Additional .ini files parsed (none)
    PHP API 20090626
    PHP Extension 20090626
    Zend Extension 220090626
    Zend Extension Build API220090626,NTS
    PHP Extension Build API20090626,NTS
    Debug Build no
    Thread Safety disabled
    Zend Memory Manager enabled
    Zend Multibyte Support disabled
    IPv6 Support enabled
    Registered PHP Streams https, ftps, compress.zlib, compress.bzip2, php, file, glob, data, http, ftp, phar, zip
    Registered Stream Socket Transports tcp, udp, unix, udg, ssl, sslv3, sslv2, tls
    Registered Stream Filters zlib.*,  bzip2.*, convert.iconv.*, string.rot13, string.toupper, string.tolower,  string.strip_tags, convert.*, consumed, dechunk, mcrypt.*, mdecrypt.*

    Zend logo This program makes use of the Zend Scripting Language Engine:
    Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
        with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans



    xdebug

    xdebug support enabled
    Version 2.1.0

    Supported protocols Revision
    DBGp - Common DeBuGger Protocol $Revision: 1.145 $

    Directive Local Value Master Value
    xdebug.auto_trace Off Off
    xdebug.collect_assignments Off Off
    xdebug.collect_includes On On
    xdebug.collect_params 0 0
    xdebug.collect_return Off Off
    xdebug.collect_vars Off Off
    xdebug.default_enable On On
    xdebug.dump.COOKIE no value no value
    xdebug.dump.ENV no value no value
    xdebug.dump.FILES no value no value
    xdebug.dump.GET no value no value
    xdebug.dump.POST no value no value
    xdebug.dump.REQUEST no value no value
    xdebug.dump.SERVER no value no value
    xdebug.dump.SESSION no value no value
    xdebug.dump_globals On On
    xdebug.dump_once On On
    xdebug.dump_undefined Off Off
    xdebug.extended_info On On
    xdebug.file_link_format no value no value
    xdebug.idekey johnwoodbridge no value
    xdebug.manual_url http://www.php.net http://www.php.net
    xdebug.max_nesting_level 100 100
    xdebug.overload_var_dump On On
    xdebug.profiler_aggregate Off Off
    xdebug.profiler_append Off Off
    xdebug.profiler_enable Off Off
    xdebug.profiler_enable_trigger Off Off
    xdebug.profiler_output_dir /var/tmp/ /var/tmp/
    xdebug.profiler_output_name cachegrind.out.%p cachegrind.out.%p
    xdebug.remote_autostart Off Off
    xdebug.remote_connect_back Off Off
    xdebug.remote_cookie_expire_time 3600 3600
    xdebug.remote_enable On On
    xdebug.remote_handler dbgp dbgp
    xdebug.remote_host localhost localhost
    xdebug.remote_log no value no value
    xdebug.remote_mode req req
    xdebug.remote_port 9000 9000
    xdebug.scream Off Off
    xdebug.show_exception_trace Off Off
    xdebug.show_local_vars Off Off
    xdebug.show_mem_delta Off Off
    xdebug.trace_format 0 0
    xdebug.trace_options 0 0
    xdebug.trace_output_dir /var/tmp/ /var/tmp/
    xdebug.trace_output_name trace.%c trace.%c
    xdebug.var_display_max_children 128 128
    xdebug.var_display_max_data 512 512
    xdebug.var_display_max_depth 3 3
    0

    Please try 127.0.0.1 instead of localhost (in xdebug.remote_host=localhost). This may help if IPv6 has priority (or something like that -- AFAIK xdebug works with IPv4 only).

    Also -- the "verification" -- please describe how do you debug (with screenshots, if possible). Maybe you are missing some step .. or executing wrong Run/Debug configuration (e.g. trying to debug CLI script .. when your PHP may simply be not configured for CLI mode, only for web)...

    You can also try v6 EAP build (can be run alongside with v5 as it stores IDE-wide settings in separate folder -- just backup project settings (.idea subfolder) if you plan to go back to v5 to work with that project): http://confluence.jetbrains.net/display/WI/Web+IDE+EAP

    0

    Hi Andriy

    I had that set to 127.0.0.1 originally and chnaged it to 'localhost' after reading a post on the web suggesting that may help.  I have changed it back to 127.0.0.1 but it makes no difference.

    "when your PHP may simply be not configured for CLI mode, only for web" - sorry, not sure how I would find this out?

    To use the debugger I

    1. Set the listener on (red handset to green)
    2. Set a breakpoint in the page to be debugged
    3. Either run the page in Firefox (the page runs and does not stop at the breakpoint)
    4. Or, right click the file in PHPStorm and choose Debug <filename>
    5. Or, choose the debug file from the PhpStorm toolbar.


    The weird thing is how I did have this configured to work but has now stopped.  I do not believe that I have applied any updates to the software, but something must have changed for it to stop working.

    I will take a look at v6, thanks.

    John

    0
    Either run the page in Firefox (the page runs and does not stop at the breakpoint)

    You need to initiate debug session (to tell xdebug that it need to debug this page). This can be done by adding some parameter to the URL (e.g.

    XDEBUG_SESSION_START=session_name -- http://xdebug.org/docs/remote
    ), via some browser extension (that will add debug cookie for you -- see the same xdebug page), or bookmarklets

    Or, right click the file in PHPStorm and choose Debug <filename>

    I'm not sure what type of Run/Debug Configuration will be created in such case -- possibly "PHP Script" (which is for CLI mode). I suggest creating your own manually of proper type ("Run | Edit Configurations.." or via drop-down box on main toolbar -- the one next to Run/Debug buttons).

    The weird thing is how I did have this configured to work but has now stopped.  I do not believe that I have applied any updates to the software, but something must have changed for it to stop working.

    Maybe it is just your MacOS updates ... hard to say.

    When you "Set the listener on (red handset to green)" -- can you check:
    1) what ports/protocols PhpStorm listens to (netstat or similar command)
    2) see if you are able to connect to xdebug port via telnet (maybe it is blocked .. or just listens on another port)

    I also hope that you do not run any another IDE/software at the same time that is capable of handling xdebug debugging (as port must be available for PhpStorm). But I guess this is rather unlikely to happen as I would expect PhpStorm to inform you that it cannot listen on required port.


    Generally speaking -- try checking debug in brand new and very simple project (just few basic lines) -- maybe your project settings are screw up or some accidental misconfiguration ... dunno.

    0

    Thanks Andriy

    Sorted!

    I upgraded to latest version of MAMP (2.1.2) which includes the latest version of xdebug.

    Also installed PhpStorm v6 and followed the advice in this post 5 Step Tutorial: PHPStorm + MAMP PRO 2

    And it works! big relief.

    Many thanks for your help and ideas.

    John

    0

    PROBLEM SOLVED!!!!!!!!!!!!

    I had the same problem. I install the PHP interpreter some months bebore - older version and XDebug. Today I install the PHPStorm and PHPStorm does not found Xdebug. I try to upgrade PHP and XDebug to the oldest version. I found XDebug in the php configuration phpinfo. But Xdebug still was not found in PHPStorm.

    HOW TO SOLVE???
    PHPStorm was saved the old (my previous) version of PHP. Click on the top menu of PHPStorm: File->Settings->PHP->Interpreter (the button on the right [...])

    In the General part you will see the version of PHP.

    Click to the refresh button right to the PHP home. Then Click OK, OK.

    PROBLEM SOLVED!!!!!!!!!!!!

    0

    Please sign in to leave a comment.