問題描述
我正在嘗試配置 xdebug 以使用 Netbeans 6.9 和 php 5.3
就我而言,我已經(jīng)正確設(shè)置了 xdebug.
我可以從 phpinfo 頁面看到 xdebug 擴(kuò)展.
我已經(jīng)閱讀了其他帖子并嘗試了他們的建議,但無濟(jì)于事
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
當(dāng)我點(diǎn)擊調(diào)試按鈕時(shí),它直接在瀏覽器中打開頁面,我可以在 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 中的設(shè)置
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"
任何幫助將不勝感激
推薦答案
首先,檢查它是否真的不適合您,并且您沒有注意到.我已經(jīng)這樣做了......確信它不起作用我浪費(fèi)了大量時(shí)間試圖讓它工作,結(jié)果發(fā)現(xiàn)一切正常.
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 狀態(tài)欄.如果您看到netbeans-xdebug"和正在運(yùn)行",那么它實(shí)際上工作得很好.您可能關(guān)閉了在第一行停止"選項(xiàng),并且您還沒有遇到您設(shè)置的任何斷點(diǎn)(如果有).這就是您看到的頁面幾乎沒有或沒有跡象表明調(diào)試器實(shí)際上已連接的原因.
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)"并且進(jìn)度條在循環(huán),那么您確實(shí)沒有連接.打開工具|選項(xiàng),然后轉(zhuǎn)到 PHP 頁面.在常規(guī)選項(xiàng)卡上,確保調(diào)試器端口"為 9000,會(huì)話 ID"為netbeans-xdebug".您可能希望選中停在第一行".我沒有,因?yàn)槲矣X得這有點(diǎn)煩人.我肯定會(huì)確保不檢查手表和氣球評(píng)估".此選項(xiàng)會(huì)導(dǎo)致 NetBeans 和調(diào)試器不穩(wěn)定.如果您需要手表,請(qǐng)?jiān)谛枰?PHP 代碼中加入一個(gè)局部變量,當(dāng)調(diào)試器運(yùn)行時(shí),您將在變量"選項(xiàng)卡上看到它.另外,確認(rèn)在項(xiàng)目的運(yùn)行配置 > 索引文件中指定了文件 (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,那么就可以了.只需確保所有值看起來都合理,并且在該頁面的某處有一些對(duì) cookieXDEBUG_SESSION=netbeans-xdebug"的引用.(確保您沒有在瀏覽器上關(guān)閉 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!)
唯一要檢查的另一件事是查看是否正在運(yùn)行某些會(huì)在本地阻止 TCP/UDP 的防火墻/安全程序(這很奇怪,但并非不可能),或者端口 9000尚未被其他應(yīng)用程序使用.由于某種原因,我在本地設(shè)置中使用了不同的端口號(hào).我不記得改變它,但我確信我唯一的原因是如果我遇到了與其他東西的端口沖突.
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.
最后一件事...我們一直假設(shè)您在同一臺(tái)計(jì)算機(jī)上運(yùn)行 NetBeans 和 Web 服務(wù)器.這是一種常見的配置,但不是唯一的配置.如果您的 Web 服務(wù)器在另一臺(tái)計(jì)算機(jī)上,請(qǐng)將 xdebug.remote_host=localhost
中的 localhost 更改為運(yùn)行 NetBeans 的計(jì)算機(jī)的 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.
最后一件事:當(dāng)循環(huán)通過令人沮喪的迭代時(shí),直到您在 phpinfo() 中看到 xdebug 信息,重新啟動(dòng) apache/php.到達(dá)那里后,仍然在迭代之間重新啟動(dòng) 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.
這篇關(guān)于Xdebug 和 Netbeans 問題的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!