本地主機(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
不過仍是沒知道解決辦法,不知道爲何。。