本地主机(Windows环境192.168.66.1)访问虚拟机(192.168.66.139)里面的搭建的php环境(系统centos6.5版本,php版本是5.5.30 ,xdebug 2.4.0),经过命令行pecl install xdebug安装的xdebug,php
在php.ini配置xdebugnginx
[Xdebug]
zend_extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so
xdebug.auto_trace = On
xdebug.idekey = phpstorm
xdebug.remote_connect_back = On
xdebug.auto_trace = On
xdebug.show_exception_trace = On
xdebug.remote_autostart = On
xdebug.remote_enable = On
xdebug.collect_vars = On
xdebug.collect_return = On
xdebug.collect_params = 1
xdebug.remote_handler=dbgp
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9001
xdebug.profiler_enable=On
xdebug.trace_output_dir = "/tmp/xdebug2222/"
xdebug.profiler_output_dir = "/tmp/xdebug/"
xdebug.remote_mode = reqweb
反问页面index.php,页面一直卡死,查看nginx错误日志,发现一直有upstream timed out (110: Connection timed out) while reading response header from upstreamcentos
php-fpm一直报超时的错误,应该是php-fpm返回请求超过了设置的时间,可是一直不知道为何会报错,脚本也没问题,服务器
发现xdebug.remote_connect_back = On把这行注释掉以后,就没问题了,邪门啊。session
官网地址:https://xdebug.org/docs/all_settings#remote_connect_backphpstorm
官网给出的这个这个参数的解释是ide
xdebug.remote_connect_back
Type: boolean, Default value: 0, Introduced in Xdebug > 2.1
If enabled, the xdebug.remote_host setting is ignored and Xdebug will try to connect to the client that made the HTTP request. It checks the $_SERVER['REMOTE_ADDR'] variable to find out which IP address to use. Please note that there is no filter available, and anybody who can connect to the webserver will then be able to start a debugging session, even if their address does not match xdebug.remote_host.php-fpm
大概意思是,设置了这个参数以后,xdebug返回数据时就不会只返回给xdebug.remote_host参数设置的IP了,任何ip请求都会返回数据,这样就能够多人共享这台服务器的php xdebug环境了。spa
不过仍是没知道解决办法,不知道为何。。