2017-06-05 103 views
0

是否有可能檢查Web服務器是否正在向Chrome發送某些東西?Xdebug和PhpStorm遠程不起作用

我以相同的方式設置PhpStorm和Web服務器,我已閱讀1000個教程,但我的PhpStorm沒有收到來自Chrome的任何內容。

這裏有一些設置:

的php.ini

zend_extension="/usr/lib/php/20160303/xdebug.so" 
xdebug.coverage_enable=on 
xdebug.default_enable=on 
xdebug.profiler_enable=on 
xdebug.profiler_output_dir="/tmp" 
xdebug.remote_autostart=on 
xdebug.remote_port=9001 
xdebug.remote_enable = on 
xdebug.remote_connect_back = on 
xdebug.idekey=PHPSTORM 
xdebug.remote_handler=dbgp 

我已禁用服務器上的防火牆。 PhpStorm正在監聽端口9001.

有些想法?

+0

如何你是否在瀏覽器中附加了一個Xdebug cookie?你使用Xdebug助手還是書籤? –

+0

我正在使用Xdebug助手。我也嘗試使用書籤。我無法理解瀏覽器是否正在發送內容。 –

+1

如果你啓用了Xdebug helper,那麼它應該在刷新時自動添加它。瀏覽器不發送任何東西 - 這是Xdebug和PhpStorm之間的連接。另外,你是否真的需要像remote_handler這樣的php.ini中的所有選項?要正常工作,只需要「zend_extension」,「xdebug.remote_enable」,「xdebug.remote_host」和「xdebug.remote_port」:https://confluence.jetbrains.com/display/PhpStorm/Xdebug+Installation+Guide。請注意,Apache可能使用不同的php.ini文件。 –

回答

1

該解決方案非常簡單!我唯一忘記的是從本地機器到我的遠程服務器的ssh隧道。

下面的例子中運行配置:

[xdebug] 
zend_extension="/usr/lib/php/20160303/xdebug.so" 
xdebug.remote_autostart=on 
xdebug.remote_host=localhost 
xdebug.remote_port=9001 
xdebug.remote_enable = on 
xdebug.idekey=PHPSTORM 

使用鉻插件的XDebug助手 https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc

而作爲最後一步,創建一個SSH隧道到遠程服務器:

ssh -R 9001:localhost:9001 [email protected] -N