doufan6544 2018-11-01 05:51
浏览 243
已采纳

安装后xdebug无法正常工作并设置php设置

I installed Xdebug on PHP 7.3 using pecl install xdebug

When I add these settings to /etc/php/7.3/apache2/php.ini and reload apache the page fails and says no data sent to server.

xdebug.var_display_max_children=-1
xdebug.var_display_max_data=-1
zend_extension="/usr/lib/php/20180731/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.halt_level=E_WARNING|E_NOTICE|E_USER_WARNING|E_USER_NOTICE
xdebug.scream=1

Not sure why its not working.

  • 写回答

2条回答 默认 最新

  • dongxiaoshe0737 2018-11-07 07:50
    关注

    (In the original version of your question, your configuration was commented out, now you've edited that bit out, leaving the next couple of paragraphs kinda out of the loop)

    Despite the documentation stating that the has character (#) is no longer recognized as a valid comment character since PHP 7.0:

    PHP Changelog

    it seems that php will happily treat those lines as commented nonetheless in configuration files. Everything afer the hash is ignored by the interpreter.

    So those configuration lines are completely ineffective.

    To verify that your configuration is being loaded, create a simple file like this:

    <php
    phpinfo();
    

    Loading this file will tell you everything about PHPs configuration. If Xdebug has been successfully loaded, you'll see something like this:

    phpinfo output

    And down below the configuration settings loaded:

    phpinfo output

    These are the most important settings, that actually load and enable the Xdebug extension:

    zend_extension="/usr/lib/php/20180731/xdebug.so"
    xdebug.remote_enable=1
    

    Important: You need to check that /usr/lib/php/20180731/xdebug.so actually exists, and if not find the actual location of your xdebug module.

    The next line assumes that the webserver and the browser are installed on the same machine on the same IP, which might be true for a simple setup:

     xdebug.remote_host=127.0.0.1
    

    As an alternative, you can tell Xdebug to connect back to whichever IP has made the orginal request

     xdebug.remote_connect_back=On
    

    With the following line you are telling on which port your IDE is listening to. It's 9000 by default, so you'll normally would not need to set it unless you need to listen to a non-standard port (e.g. debugging several projects at the same time, against different interpreters). But normally, you can omit this line safely:

    xdebug.remote_port=9000
    

    Once the module is loaded and enabled, you can also configure some Xdebug settings using an environment variable. Specifically xdebug.remote_host, xdebug.remote_port, xdebug.remote_mode and xdebug.remote_handler

    E.g:

    export XDEBUG_CONFIG="remote_host=192.168.0.3 remote_port=9005"
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 矩阵加法的规则是两个矩阵中对应位置的数的绝对值进行加和
  • ¥15 活动选择题。最多可以参加几个项目?
  • ¥15 飞机曲面部件如机翼,壁板等具体的孔位模型
  • ¥15 vs2019中数据导出问题
  • ¥20 云服务Linux系统TCP-MSS值修改?
  • ¥20 关于#单片机#的问题:项目:使用模拟iic与ov2640通讯环境:F407问题:读取的ID号总是0xff,自己调了调发现在读从机数据时,SDA线上并未有信号变化(语言-c语言)
  • ¥20 怎么在stm32门禁成品上增加查询记录功能
  • ¥15 Source insight编写代码后使用CCS5.2版本import之后,代码跳到注释行里面
  • ¥50 NT4.0系统 STOP:0X0000007B
  • ¥15 想问一下stata17中这段代码哪里有问题呀