2015-09-13 53 views
0

我使用PHPStorm並試圖根據此視頻https://laracasts.com/series/how-to-be-awesome-in-phpstorm/episodes/20?autoplay=true運行Xdebug。使用設置Xdebug和PHPStorm進行調試

第一部分完美工作(https://laracasts.com/series/how-to-be-awesome-in-phpstorm/episodes/19?autoplay=true),但我卡在第二個。

端口9000是行不通的,所以我改成了10000

我配置PHP Web應用程序配置

enter image description here enter image description here

後,我按調試按鈕,網頁是空白

enter image description here

an d仍在加載,PHPStorm正在等待傳入連接。

enter image description here

我已籤 「可以接受外部連接」 在PHP - 調試 - 在配置這樣的php.ini的Xdebug和Xdebug:

[XDebug] 

zend_extension="/usr/local/Cellar/php56-xdebug/2.3.3/xdebug.so" 

xdebug.remote_enable = 1 
xdebug.cli_color = 1 
xdebug.show_local_vars = 1 

xdebug.remote_port = 10000 
xdebug.remote_host= localhost 
xdebug.remote_autostart = 1 

xdebug.remote_log="/usr/local/tmp/xdebug.log" 
xdebug.idekey = "PHPSTORM" 
xdebug.ide_key = "PHPSTORM" 
xdebug.profiler_enable = 1 
xdebug.profiler_output_dir="/usr/local/tmp/xdebug-profiler" 
xdebug.profiler_enable_trigger = 1 

我試圖驗證Web服務器與此結果:

enter image description here

我google搜索,並試圖解決這個6小時,儘量幫我請,我真的這種虛擬。

使用OS X El Capitan。

我可以調試單個腳本,但不是整個網站。

當我直接運行online-chef.dev:10000時,它說ERR_CONNECTION_REFUSED。

「online-chef.dev」位於本地虛擬主機。

我做錯了什麼?

非常感謝!

+0

'web服務器端口'和'xdebug端口'是2個不同的東西。你在這裏把它們混在一起。我建議從頭開始:1)https://www.jetbrains.com/phpstorm/quickstart/debugger.html 2)https://confluence.jetbrains.com/display/PhpStorm/Debugging+with+PhpStorm – LazyOne

+0

如果你將忽略這句話「當我直接運行這個..」,什麼是我的配置不好? –

+0

您已將xdebug配置爲使用與您的Web服務器相同的10000端口。這是明顯的錯誤 - 它不這樣工作。當xdebug收到調試請求時,使用你的配置,它會嘗試連接到Web服務器(端口)而不是IDE。是的 - 它是連接到IDE(調試客戶端)而不是其他方式的xdebug。 – LazyOne

回答

0

您試圖通過xdebug調試網頁。對於調試JavaScript,您需要安裝browser extentionThis is manual for javascript debugging

對於JavaScript調試獲取當前extention端口,在這個地方輸入:

enter image description here

對於XDebug的,我不想總是單擊調試按鈕,所以我簡單的讓聽的連接。來自JetBrains的This is manual for XDebug

enter image description here

下面是用聽的連接工作我Xdebug的配置。

xdebug.idekey = "PHPSTORM" 
xdebug.remote_port = 9001 
xdebug.remote_mode = "req" 
xdebug.remote_host = 10.0.2.2 
xdebug.remote_handler = "dbgp" 
xdebug.remote_enable = 1 
xdebug.remote_autostart = 1 
xdebug.extended_info = 1 

所以,當我需要調試javascript時,我點擊調試按鈕。當我需要調試的PHP我只是把斷點。

首先設置調試工具通常很困難,但它是值得的。

+0

A已經設置了收聽連接(手機圖標)和分機。 什麼是remote_mode?它是否必要? –

+0

我更新了答案。嘗試安裝正確的端口。 http://xdebug.org/docs/all_settings#remote_mode - 這是關於遠程模式。 –

+0

感謝您的幫助和解釋。主要的事情是用xdebug&web端口進行廢棄。感謝幫助。 –