Php xdebug为什么不';我不能在阿帕奇工作

Php xdebug为什么不';我不能在阿帕奇工作,php,apache,xdebug,Php,Apache,Xdebug,/var/www/html/index.php <?php echo 'a'; echo 'a'; xdebug工作得很好 但是,当由类似apache的 $ curl 'http://localhost:80?XDEBUG_SESSION_START=1' aa xdebug没有发生任何事情 下面是apache的错误日志,没有什么特别的 1[Fri Jun 17 05:02:15.526773 2016][mpm_prefork:notice][pid 30840]AH0

/var/www/html/index.php

<?php
   echo 'a';
   echo 'a';
xdebug工作得很好

但是,当由类似apache的

$ curl 'http://localhost:80?XDEBUG_SESSION_START=1'
aa
xdebug没有发生任何事情

下面是apache的错误日志,没有什么特别的

1[Fri Jun 17 05:02:15.526773 2016][mpm_prefork:notice][pid 30840]AH00163:Apache/2.4.7(Ubuntu)PHP/5.5.9-1ubuntu4.17已配置--恢复正常操作│ 限定域名,使用10.0.2.15。设置“ServerName”目录 2[Fri Jun 17 05:02:15.526839 2016][core:notice][pid 30840]AH00094:命令行:'/usr/sbin/apache2'

我在Vagrant虚拟机中使用Apache/2.4.7、PHP/5.5.9、Ubuntu、vim和DBGPavim。
我怎样才能找到xdebug不能通过apache工作的原因呢?

经过大量的搜索,这就是我最终能够工作的原因。希望这有帮助

我正在使用PHP7.0.21、Zend Engine v3.0.0和Xdebug v2.5.0。在重新启动apache之前,我运行了以下命令

# Step 1 : In xdebug.ini or php.ini enable xdebug
sed -i 's/;zend_extension=xdebug.so/zend_extension=xdebug.so/' /etc/php7/conf.d/xdebug.ini
echo -e "xdebug.remote_enable=1\nxdebug.remote_handler=dbgp\nxdebug.remote_mode=req\nxdebug.remote_host=127.0.0.1\nxdebug.remote_port=9000" >> /etc/php7/conf.d/xdebug.ini

# Step 2: Copy the php + xdebug configuration files to apache
cp /etc/php7/php.ini /etc/apache2/ && \
cp /usr/lib/php7/modules/xdebug.so /usr/lib/apache2 && \
cp /etc/php7/conf.d/xdebug.ini /etc/apache2/conf.d/ && \
修复后我的文件布局被删除

/etc
|--php7
|     |-- php.ini
|     |-- conf.d
|              |-- xdebug.ini
|--apache2
|     |--php.ini
|     |-- conf.d
|              |-- xdebug.ini


/usr/lib
|--php7
|    |--modules
|          |--xdebug.so
|--apache2
|    |--modules
|          |--xdebug.so

我发现这个文档非常有用

您是否在php.ini中配置或启用了xdebug?@ChetanAmeta应该是。下面是php-i xdebug.remote\u autostart=>On=>On xdebug.remote\u connect\u back=>Off=>Off xdebug.remote\u cookie\u expire\u time=>3600=>3600 xdebug.remote\u enable=>On xdebug.remote\u处理程序=>dbgp=>dbgp xdebug.remote\u主机=>localhost=>localhost xdebug.remote\u日志=>no value=>no-value xdebug.remote\u mode=>req=>xdebug.remote_port=>9000=>9000和php-m[Zend Modules]xdebug-Zend-OPcacheit将有两个php.ini,一个用于cli,一个用于apache,您为这两个都配置了吗?@ChetanAmeta您是对的。我只配置了/etc/php5/cli/php.ini。在配置/etc/php5/apache2/php.ini之后,xdebug在apache下运行良好。谢谢。
/etc
|--php7
|     |-- php.ini
|     |-- conf.d
|              |-- xdebug.ini
|--apache2
|     |--php.ini
|     |-- conf.d
|              |-- xdebug.ini


/usr/lib
|--php7
|    |--modules
|          |--xdebug.so
|--apache2
|    |--modules
|          |--xdebug.so