問題描述
我正在嘗試配置 xdebug 以使用 Netbeans 6.9 和 php 5.3
就我而言,我已經正確設置了 xdebug.
我可以從 phpinfo 頁面看到 xdebug 擴展.
我已經閱讀了其他帖子并嘗試了他們的建議,但無濟于事
Im trying to configure xdebug to work with Netbeans 6.9 and php 5.3
As far as i concern i have setup xdebug properly.
I can see xdebug extension from phpinfo page.
I have read other post and tried their suggestion but up to no avail
當我點擊調試按鈕時,它直接在瀏覽器中打開頁面,我可以在 netbeans 的底部窗格中看到消息等待連接"
When i hit the debug button, it straight open the page in the browser and i can see message 'Waiting for connection' in the bottom pane of netbeans
這里是我在 php.ini 中的設置
Here my setting in php.ini
zend_extension = /usr/lib/php5/20090626+lfs/xdebug.so
xdebug.remote_enable=on
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey="netbeans-xdebug"
任何幫助將不勝感激
推薦答案
首先,檢查它是否真的不適合您,并且您沒有注意到.我已經這樣做了......確信它不起作用我浪費了大量時間試圖讓它工作,結果發現一切正常.
First, check that it isn't actually working for you, and you don't notice. I've done this...convinced it's not working I wasted a chunk of time trying to get it to work, only to find that everything was OK.
查看您的 NetBeans 狀態欄.如果您看到netbeans-xdebug"和正在運行",那么它實際上工作得很好.您可能關閉了在第一行停止"選項,并且您還沒有遇到您設置的任何斷點(如果有).這就是您看到的頁面幾乎沒有或沒有跡象表明調試器實際上已連接的原因.
Look at your NetBeans status bar. If you see "netbeans-xdebug" and "running" then it is actually working just fine. You probably have the "Stop at first line" option turned off and you didn't hit any breakpoints you set (if any) yet. That would be a reason you are seeing the page with little or no indication that the debugger is actually connected.
如果您看到的是Waiting for Connection (netbeans-xdebug)"并且進度條在循環,那么您確實沒有連接.打開工具|選項,然后轉到 PHP 頁面.在常規選項卡上,確保調試器端口"為 9000,會話 ID"為netbeans-xdebug".您可能希望選中停在第一行".我沒有,因為我覺得這有點煩人.我肯定會確保不檢查手表和氣球評估".此選項會導致 NetBeans 和調試器不穩定.如果您需要手表,請在需要它的 PHP 代碼中加入一個局部變量,當調試器運行時,您將在變量"選項卡上看到它.另外,確認在項目的運行配置 > 索引文件中指定了文件 (index.php).
If you instead see "Waiting for Connection (netbeans-xdebug)" and the progress bar is cycling, then you are indeed not connected. Open Tools|Options, and go to the PHP page. On the general tab, make sure that the "Debugger port" is 9000 and the "Session ID" is "netbeans-xdebug". You may want to have "Stop at First Line" checked. I don't, as I find it a bit annoying. I would definitely ensure that "Watches and Balloon Evaluation" is not checked. This option causes NetBeans and the debugger to destabilize. If you need a watch, hack a local variable into the PHP code where you need it, and you'll see it on the "Variables" tab when the debugger is running. Also, confirm that file (index.php) is specified in the project's Run Configuration > Index File.
既然您在 phpinfo()
中看到了 xdebug,那么就可以了.只需確保所有值看起來都合理,并且在該頁面的某處有一些對 cookieXDEBUG_SESSION=netbeans-xdebug"的引用.(確保您沒有在瀏覽器上關閉 cookie!)
Since you see xdebug in phpinfo()
, that end of it is fine. Just make sure that all of the values look reasonable, and that there is some reference to a cookie "XDEBUG_SESSION=netbeans-xdebug" somewhere on that page. (Make sure that you don't have cookies turned off on the browser!)
唯一要檢查的另一件事是查看是否正在運行某些會在本地阻止 TCP/UDP 的防火墻/安全程序(這很奇怪,但并非不可能),或者端口 9000尚未被其他應用程序使用.由于某種原因,我在本地設置中使用了不同的端口號.我不記得改變它,但我確信我唯一的原因是如果我遇到了與其他東西的端口沖突.
The only other thing to check is to see if some firewall/security program is running that would be blocking TCP/UDP locally (which would be super-odd, but not out of the realm of possibility), or that port 9000 isn't already used by another application. I am using a different port number in my local setup for some reason. I don't remember changing it, but I am sure that the only reason I would have is if I had hit a port conflict with something else.
最后一件事...我們一直假設您在同一臺計算機上運行 NetBeans 和 Web 服務器.這是一種常見的配置,但不是唯一的配置.如果您的 Web 服務器在另一臺計算機上,請將 xdebug.remote_host=localhost
中的 localhost 更改為運行 NetBeans 的計算機的 IP 地址.
One last thing... We've been assuming that you are running NetBeans and the web server on the same computer. That's a common configuration, but not the only one. If your web server is on a different computer, then change the localhost in xdebug.remote_host=localhost
to the IP address of the computer on which NetBeans is running.
最后一件事:當循環通過令人沮喪的迭代時,直到您在 phpinfo() 中看到 xdebug 信息,重新啟動 apache/php.到達那里后,仍然在迭代之間重新啟動 NetBeans.信不信由你,重啟瀏覽器.
Another last thing: When cycling through frustrating iterations, until you see xdebug info in phpinfo(), restart apache/php. Once there, still restart NetBeans between iterations. And believe it or not, restart your browser.
這篇關于Xdebug 和 Netbeans 問題的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!