无法连接到 PHPStorm 中的 xdebug

Can't connect to xdebug in PHPStorm

问题

所以我觉得虽然我已经尝试了所有方法,但仍然无法让 xdebug 连接到 phpstorm。我说它正在等待连接,然后当我加载页面时,使用 get 变量 ?XDEBUG_SESSION_START=PHPSTORM 或 chrome 扩展,消息短暂变为 connected,然后返回等待. 错误:

E:\xampp\apache\logs\xdebug.log的错误日志中如下

Log opened at 2016-03-29 16:35:40
I: Connecting to configured address/port: 12hitchinscouts.local:9001.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///E:/Users/Roshan/PhpstormProjects/12hitchinscouts.org.uk/index.php" language="PHP" protocol_version="1.0" appid="4396" idekey="PHPSTORM"><engine version="2.2.5"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2014 by Derick Rethans]]></copyright></init>

<- feature_set -i 1 -n show_hidden -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1" feature="show_hidden" success="1"></response>

<- feature_set -i 2 -n max_depth -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="max_depth" success="1"></response>

<- feature_set -i 3 -n max_children -v 100
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="max_children" success="1"></response>

<- status -i 4
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="status" transaction_id="4" status="starting" reason="ok"></response>

<- step_into -i 5
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="5" status="stopping" reason="ok"></response>

<- breakpoint_set -i 6 -t line -f file://E:/Users/Roshan/PhpstormProjects/12hitchinscouts.org.uk/index.php -n 8
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="6"><error code="5"><message><![CDATA[command is not available]]></message></error></response>

Log closed at 2016-03-29 16:35:41

我当前的配置

我在 Windows 7 Pro 上使用 Apache 2.4 xampp 和 php5.6

php.ini

[XDebug]
zend_extension = "E:\xampp\php\ext\php_xdebug.dll"
xdebug.profiler_append = 0
xdebug.profiler_enable = 1
xdebug.profiler_enable_trigger = 0
xdebug.profiler_output_dir = "E:\xampp\tmp\xdebug"
xdebug.profiler_output_name = "cachegrind.out.%t-%s"
xdebug.idekey = PHPSTORM
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "12hitchinscouts.local"
xdebug.remote_port= 9001
xdebug.remote_log= "E:\xampp\apache\logs\xdebug.log"
xdebug.trace_output_dir = "E:\xampp\tmp\xdebug"
xdebug.extended_info  = 1

php信息

PHPStorm

我试过的

如果您需要更多信息,请随时询问,但我认为我已经提供了所有信息。

谢谢

哇哦,你到达底部了:)

编辑

这是我的 php 文件:

<?php
//set page title
$title = "Welcome";
//for Facebook and twitter
$metaTitle = 'Looking to join Scouting or find out about our group?'; //title for post
$metaImage = 'http://12hitchinscouts.org.uk/images/FB-img.JPG'; //image url for post
$metaDesc = 'This is the official website for the 12th Hitchin scout group. Here you can find out about our different sections; when and where they meet as well as what they\'ll be doing next. This group consists of beavers cubs and scouts sections.'; //description to appear on post
$headMeta = '<!--for extra google results page features and SEO-->
    <script type="application/ld+json">
    {
       "@context": "http://schema.org",
       "@type": "Organization",
       "url": "https://12hitchinscouts.org.uk/",
       "logo": "http://12hitchinscouts.org.uk/images/12th-Logo.png",
       "name" : "12th Hitchin Scouts",
       "sameAs" : [ "http://www.facebook.com/groups/12hitchinscouts/",
        "http://www.twitter.com/12thhs" ],
       "potentialAction": {
         "@type": "SearchAction",
         "target": "https://12hitchinscouts.org.uk/search#stq={search_term_string}",
         "query-input": "required name=search_term_string"
       }
    }
    </script>
    <meta name="Description" content="This is the homepage for the 12th Hitchin scouts, from here you can find out what\'s going on and see upcoming activities for each section of our Hitchin scout group. Hitchin is our home too, and that\'s why we are commited to helping our local area aswell as other usual scouting activities.">'; //schema info for google
xdebug_break();
require("includes/head.php");
?>
<link href="css/index_response.css" rel="stylesheet" type="text/css">
<!--content-->
  <div class="fluid Title"><h1>Welcome!</h1></div>
    <br />
    <div class="fluid twitter hide_mobile ">
        <h2>Tweets
            <span class="follow">
                <a href="https://twitter.com/12thhs" target="_blank">
                <img src="images/Twitter_logo.gif" />
                Follow
                </a>
            </span>
        </h2>
        <br />
        <span class="tweets">
        <?php include_once("includes/twitter.php"); ?>
        </span>
    </div>
    <div class="fluid what">
        <h2>What is scouting?</h2>
        <p>Scouts was invented in 1907 by Robert Baden-Powell with just 20 boys. Over
a century later the number is into millions worldwide. There are many
stories around scouting, which could take up this entire pack – but suffice to
say it has evolved over the last century in many different ways.
We aim to ensure that a balanced programme is achieved which allows the
children to grow mentally, physically, socially and spiritually. Scouts
nowadays still need to Be Prepared as the old motto goes, and we have
many activities that are fun, testing and hopefully, a little bit out of the
ordinary – offering something new and different to everyone. We have tried
many activities over the last few years ranging from Bowling and archery to
bouldering and kayaking. We have walked in the peak district camping
overnight, conversely, we have walked for a couple of hours around
Deacon’s hill in Hitchin.</p>
<p>All the scout basics are there, including hiking, camping, first aid and
numerous badges catering from hobbies and activities to in depth levelled
badges for swimming or aeronautics! We also aim to complete a Challenge
Badge every 1-2 terms, which when collected gains the Chief Scouts Gold
award – the highest accolade available as a Scout. To earn this, Scouts show
their creativity, outdoor skills, help the community, learn about faiths and
tolerance and ultimately – go on an expedition for a few days, planned and
carried out by themselves!</p>
<p>Joining the scouts will leave you in esteemed company as people such as
Kate Middleton, Major Tim Peake, David Beckham, Nelson Mandela, Barack Obama, Richard
Branson, Ross Kemp and our current Chief Scout Bear Grylls, have all been
involved in scouting.</p>
    </div>
    <div class="fluid index_events">
        <h2>Upcoming events</h2>
        <?php 
        $no = 1; //number of upcoming events to display, 0 or less shows 1. Non integers are rounded and values of 0 or less are turned to 1
        $index = 1; //this is the index page, leave blank for implementation on other pages. uses if($index == 1) logic
        $limit['years'] = 1;//how far into the future should it show events? Non integers are rounded and values of 0 or less are turned to 1
        //This shows events from all sections, to specify a section, a line must be added the SQL queries
        include("includes/upcoming_events.php");
        ?>
    </div>    
    <div class="fluid galery">
        <h2>Gallery</h2><p><a href="/gallery">Visit full gallery</a></p>
        <?php require("includes/gallery_embed.php"); ?>
   </div>
<!--end content-->
    <?php require("includes/footer.php"); ?>

我知道我拼错了 gallery,我只是还没来得及改正它:)

编辑 2

x 调试日志

Log opened at 2016-03-29 18:21:04
I: Connecting to configured address/port: 127.0.0.1:9001.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///E:/Users/Roshan/PhpstormProjects/12hitchinscouts.org.uk/index.php" language="PHP" protocol_version="1.0" appid="11672" idekey="PHPSTORM"><engine version="2.2.5"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2014 by Derick Rethans]]></copyright></init>

<- feature_set -i 1 -n show_hidden -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1" feature="show_hidden" success="1"></response>

<- feature_set -i 2 -n max_depth -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="max_depth" success="1"></response>

<- feature_set -i 3 -n max_children -v 100
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="max_children" success="1"></response>

<- status -i 4
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="status" transaction_id="4" status="starting" reason="ok"></response>

<- step_into -i 5
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="5" status="stopping" reason="ok"></response>

<- breakpoint_set -i 6 -t line -f file://E:/Users/Roshan/PhpstormProjects/12hitchinscouts.org.uk/index.php -n 3
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="6"><error code="5"><message><![CDATA[command is not available]]></message></error></response>

Log closed at 2016-03-29 18:21:05

PHPStorm 日志

太长了 post pastebin

尝试使用这些设置,并下载 this dll 文件。它对我来说很好用:

[XDebug]
zend_extension = "E:\xampp\php\ext\php_xdebug.dll"
xdebug.remote_host=localhost
xdebug.remote_enable=1
xdebug.remote_handler="dbgp"
xdebug.remote_port=9000

正如@LazyOne 在评论中所述,我需要将我的 xdebug 版本更新为 2.3.2

LazyOne 没有 post 答案所以我正在做,如果他们这样做,我会接受他们的。