[英]How to use XDebug and vim when the connection is "wasted" by a prior uninteresting server call
我正在使用帶有Vdebug 插件和 Xdebug 的 vim 來調試nextcloud 實例的 WebDAV 服務器。 Nextcloud 使用 SabreDAV,所以 WebDAV 服務器是一個 PHP 腳本。 nextcloud 使用的桌面文件同步客戶端 ( owncloud)將本地文件夾與 nextcloud 網絡存儲保持同步。
我想根據 WebDAV 文件上傳(大概是PUT
)請求調試 nextcloud 服務器的配額計算問題。 但是,如果本地文件發生更改,則 owncloud 客戶端會向服務器發出多個 WebDAV 請求,其中第一個請求對我來說並不重要(大概是PROPFIND
或類似請求)。 只有在這個無趣的請求之后,才會發送上傳請求。 但是,如果我設置 vim 來偵聽 Xdebug ( :VdebugStart
) 的傳入連接,則第一個無趣的 WebDAV 請求會建立連接,但我想為以后傳入的 Xdebug 連接建立連接。 但是,在 owncloud 客戶端使用有趣的 WebDAV 請求再次調用服務器之前,我的速度不夠快,無法將 vim 設置為偵聽模式。
可能有兩種處理方式:
xdebug_connect_now_to_client()
函數,而不是從一開始xdebug_connect_now_to_client()
接到 vim 的 Xdebug。您知道實現其中一個目標的可能性,還是有其他解決方案?
相關php.ini
條目:
zend_extension=xdebug.so
xdebug.remote_enable=on
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
; have to set this, because owncloud does not set the
; XDEBUG_START_SESSION=true GET parameter
xdebug.remote_autostart=on
xdebug.idekey=netbeans-xdebug
像你一樣,我在使用 xdebug 和 vdebug 在 NextCloud 中調試 WebDav 請求時遇到了這個問題。
我喜歡上面的 LazyOne 建議在斷點處編碼。
我最終做的是設置
xdebug.remote_autostart=0
並盡可能使用下面的插件來僅針對我的請求啟用調試。
https://addons.mozilla.org/en-US/firefox/addon/xdebug-helper-for-firefox/
我還發現最初啟用跟蹤有助於至少了解我需要查看代碼中的哪個位置,這也可能有助於您手動設置斷點。 在這里,您可以再次使用插件來最小化將生成跟蹤的請求。
xdebug.remote_log=/tmp/xdebug_remote.log
xdebug.trace_options=1
# Write a trace file per process
xdebug.trace_output_name=trace.%p
# Only trace if we get XDEBUG_TRACE
xdebug.auto_trace=0
xdebug.trace_enable_trigger=1
我正在使用 php-fpm 我也設置了
; Choose how the process manager will control the number of child processes.
; Possible Values:
; static - a fixed number (pm.max_children) of child processes;
pm = static
這樣就不會有大量進程創建跟蹤文件和發出請求
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.