2016-05-21 6 views
2

Dockerコンテナ内で作成されていないプロジェクトをデバッグすると、Xdebugに問題はありません。XdebugはDockerコンテナ内に作成されたPhpプロジェクトのNetbeansのブレークポイントを無視します

しかし、私がDockerコンテナ内で作成したプロジェクトをデバッグすると、Xdebugはブレークポイントで停止しません - 実行中でxdebug_break()で停止します。

My DockerホストはUbuntu 14.04です。 VirtualBoxとしてインストールされます。 Xdebug v2.2.3でPHP 5.5.9-1ubuntu4.16を使用しています。 Dockerコンテナ内に作成されたプロジェクトが格納されているマウントされたボリューム(DockerホストとDockerコンテナの間)があります。

Ubuntu 14.0.4のMy Dockerコンテナは、CentOS 6.7(最終版)に基づいています。それははXdebug v2.1.4でPHP 5.3.29を使用し、(/etc/php.d/xdebug.ini内で)次のようにXdebugを構成していますコメントアウトとして

zend_extension=/usr/lib64/php/modules/xdebug.so 
;xdebug.remote_autostart = 0 
xdebug.remote_autostart = 1 
xdebug.remote_connect_back = 1 
xdebug.remote_enable = 1 
;xdebug.remote_host = 127.0.0.1 
;xdebug.remote_host = localhost 
;xdebug.remote_host = 172.17.42.1 
;xdebug.remote_host = 10.0.2.15 
;xdebug.remote_host = 10.0.2.2 
;xdebug.remote_port = 9001 
xdebug.remote_port = 9000 
xdebug.remote_handler = dbgp 
xdebug.profiler_enable_trigger = 1 
xdebug.profiler_output_dir = /home/devteam/xdebug/profiler 
xdebug.remote_log=/home/devteam/xdebug/xdebug.log 
xdebug.profiler_output_name = cachegrind.out.%c 
xdebug.show_exception_trace = 1 
xdebug.idekey = netbeans-xdebug 

私はすべてをチェックして、現在表示されています、xdebug.remote_port設定の値。私はxdebug.remote_portの設定(もちろんNetbeansの中で同じポートを設定する)のために、別のポート(9001,9002)を試しました。また、xdebug.remote_connect_backとxdebug.remote_autostartの設定を変更しようとしました。私はこれらの2つを0に設定すると、xdebugが実際にハングして接続を待っていることに気付きました。

しかし、以前はDockerコンテナ内に以前に配置されたプロジェクトをデバッグする際に、ブレークポイントでXdebugを停止させることができませんでした。

Netbeansの設定やXdebugの設定に関する情報が不足しているかどうかはわかりません。私は解決策を見つけようと多くの時間を費やしました。私はxdebug.log内のいくつかの関連情報を検索しようとしていた - しかし、私にとって重要なものが含まれていないようです:

... 
<- breakpoint_set -i 1567 -t line -s enabled -f file:///var/www/html/test/index.php -n 3 
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="1567" state="enabled" id="11710015"></response> 

<- breakpoint_set -i 1568 -t line -s enabled -f file:///home/pkowalski/clients/deployments/demon-prep/application/bootstrap_http.php -n 7 
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="1568" state="enabled" id="11710016"></response> 

<- run -i 1569 
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="1569" status="stopping" reason="ok"></response> 

Log closed at 2016-05-20 23:38:11 

Log opened at 2016-05-20 23:40:23 
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///mnt/deployments/demon-prep/application/bootstrap_http.php" language="PHP" protocol_version="1.0" appid="1172" idekey="netbeans-xdebug"><engine version="2.1.4"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2012 by Derick Rethans]]></copyright></init> 

<- feature_set -i 1570 -n show_hidden -v 1 
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1570" feature="show_hidden" success="1"></response> 
... 

が正常にブレークポイントを設定する管理のように思えますが、ファイルパスかどうかはわかりませんxdebug.logの中で正しいです。たぶんNetBeansの中で手動のパスマッピングを使用する必要があるかもしれませんが、どうやってどのようなパスをサーバーパスにするのかはわかりません。

今すぐデバッグを開始すると、ページが読み込まれます。しかし、以前は、ブラウザ内に接続がリセットされたというエラーがありました。 それ以外にも、エラーポップアップが数回表示されていました。ポップアップが、NetbeansとXdebugの間に通信の問題があると言っていました。それ以外の時に、別のメッセージが表示されました - ソケット接続エラーが発生しました。なぜ私はこれらのポップアップが表示されないのか分かりません。

Dockerコンテナ内に作成されたプロジェクトのNetbeansでブレークポイントを無視するXdebugの解決策は何でしょうか?

答えて

3

最後に私は自分でこの問題を解決しました。

私の予想通り、解決策は、Netbeansでパスマッピングを適切に設定することでした。

xdebugを解析した後。今日、再びログインすると、私は、ログの始まりは興味深い情報が含まれていることに気づいた - INIT要素の属性fileuriの値:私は私のドッカーホストのディレクトリを共有

<init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///mnt/deployments/my-project/application/bootstrap_http.php" language="PHP" protocol_version="1.0" appid="139" idekey="netbeans-xdebug"><engine version="2.1.4"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2012 by Derick Rethans]]></copyright></init> 

方法は、 my-project、Dockerコンテナ付き、の実行中ドッカーのコンテナのドッカーサブコマンドは:ドッカー実行... -v/home/pkowalski/clients/deployments:/ mnt/deployment

を次のように(>詳細 - - >ファイル名を指定して実行Configurtionプロジェクトのプロパティ)だから私はNetBeansは私のプロジェクトのためのブレークポイントを無視して問題を解決するために何をしたか、私はNetbeansの内部パスマッピングを設定した

サーバパス:/ mntに/展開/私のプロジェクト

プロジェクトパス:/ホーム/ pkowalski /クライアント/展開/私のプロジェクト

私が作成したソフトリンクを持っているので最初に/home/devteam/deployments/my-projectをサーバパスの値として入れようとしましたが、のln -s/mnt/deployments/home/devteam/deployments は、しかしそれはうまくいかなかった。

とは別に、今では全くxdebug.remote_hostセットとし、xdebug.remote_autostartセット0か1のどちらかにして私のために動作します。

zend_extension=/usr/lib64/php/modules/xdebug.so 
xdebug.remote_autostart = 0 
xdebug.remote_connect_back = 1 
xdebug.remote_enable = 1 
xdebug.remote_port = 9000 
xdebug.remote_handler = dbgp 
:ここ

は私の/etc/php.d/xdebug.iniドッカー容器内部の最終的な作業内容であります
関連する問題