PHP在curl_exec時使用xdebug卡主,報錯Internal Server Error

(時間着急想要看解決方案的直接查看【解決方案】)

問題描述:在一次跨域請求時,當xdebug斷點打在curl_exec上,點擊下一步後一直卡主,然後等待42秒報錯Internal Server Error。

 

詳細報錯信息:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at [email protected] to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.

 

找錯過程:

首先我在百度輸入關鍵詞‘Internal Server Error’,結果百度都是說是.htaccess文件的錯誤,各種方法試了一個遍,都沒用。

其次我懷疑是不是php.ini中curl沒打開,打印phpinfo發現並沒有問題。

使用curl_error,沒有報錯信息。

 

解決曙光:

解決問題的思路是從讓同事幫忙調錯的時候開始的。

他有一個習慣,他不喜歡用xdebug,所以每次調錯都會把xdebug的小話筒關掉,然後問題就神奇的解決了。但是當我把小話筒打開,甚至我連斷點都沒有打的情況下執行curl_exec程序仍然會卡在這裏。此時我就覺得,這裏curl_exec執行不了極大可能和xdebug有關係,所以一組關鍵詞浮現在我的腦海。。。,對就是‘xdebug curl_exec’,在谷歌裏輸入關鍵詞,找到解決方案:https://stackoverflow.com/questions/32212672/xdebug-session-in-phpstorm-stuck-on-curl-exec-call/32212674

這裏感謝谷歌,幫我解決了問題。

 

解決方案:

phpstorm->file->settings->languages & framewords ->php->debug->external connnections ,

將Max.simultaneous connections 改爲2,完美!

發佈了10 篇原創文章 · 獲贊 5 · 訪問量 7763
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章