WSL上にLAMP環境を入れてwindows側のvscodeよりデバッグをしたいのですが、ブレークポイントを設定してブラウザよりアクセスしてもブレークしません。
どこか設定のミスが有ると思うのですが、お知恵を拝借願います。
###ubuntu側
- PHP7.1を導入済み。下記にphpinfoで表示したxdebug部分を記します。
- codeigniterのソースコードを/mnt/c/Users/nullbot/ubuntu/www/apps 以下に配置ついでに/home/nullbot/ubuntu -> /mnt/c/Users/nullbot/ubuntu とシンボリックリンク作成
- virtualhostでapps.mydomainとしてアクセスできるように設定
- /etc/hostsに上記をドメインを追記
Directive | Local Value | Master Value |
---|---|---|
xdebug.auto_trace | Off | Off |
xdebug.cli_color | 0 | 0 |
xdebug.collect_assignments | Off | Off |
xdebug.collect_includes | On | On |
xdebug.collect_params | 0 | 0 |
xdebug.collect_return | Off | Off |
xdebug.collect_vars | Off | Off |
xdebug.coverage_enable | On | On |
xdebug.default_enable | On | On |
xdebug.dump.COOKIE | no value | no value |
xdebug.dump.ENV | no value | no value |
xdebug.dump.FILES | no value | no value |
xdebug.dump.GET | no value | no value |
xdebug.dump.POST | no value | no value |
xdebug.dump.REQUEST | no value | no value |
xdebug.dump.SERVER | no value | no value |
xdebug.dump.SESSION | no value | no value |
xdebug.dump_globals | On | On |
xdebug.dump_once | On | On |
xdebug.dump_undefined | Off | Off |
xdebug.extended_info | On | On |
xdebug.file_link_format | no value | no value |
xdebug.filename_format | no value | no value |
xdebug.force_display_errors | Off | Off |
xdebug.force_error_reporting | 0 | 0 |
xdebug.gc_stats_enable | Off | Off |
xdebug.gc_stats_output_dir | /tmp | /tmp |
xdebug.gc_stats_output_name | gcstats.%p | gcstats.%p |
xdebug.halt_level | 0 | 0 |
xdebug.idekey | Listen for XDebug | Listen for XDebug |
xdebug.max_nesting_level | 256 | 256 |
xdebug.max_stack_frames | -1 | -1 |
xdebug.overload_var_dump | 2 | 2 |
xdebug.profiler_aggregate | Off | Off |
xdebug.profiler_append | Off | Off |
xdebug.profiler_enable | On | On |
xdebug.profiler_enable_trigger | Off | Off |
xdebug.profiler_enable_trigger_value | no value | no value |
xdebug.profiler_output_dir | /var/log/xdebug | /var/log/xdebug |
xdebug.profiler_output_name | cachegrind.out.%p | cachegrind.out.%p |
xdebug.remote_addr_header | no value | no value |
xdebug.remote_autostart | On | On |
xdebug.remote_connect_back | Off | Off |
xdebug.remote_cookie_expire_time | 3600 | 3600 |
xdebug.remote_enable | On | On |
xdebug.remote_handler | dbgp | dbgp |
xdebug.remote_host | apps.mydomain | apps.mydomain |
xdebug.remote_log | /var/log/xdebug | /var/log/xdebug |
xdebug.remote_mode | req | req |
xdebug.remote_port | 9000 | 9000 |
xdebug.remote_timeout | 200 | 200 |
xdebug.scream | Off | Off |
xdebug.show_error_trace | Off | Off |
xdebug.show_exception_trace | Off | Off |
xdebug.show_local_vars | Off | Off |
xdebug.show_mem_delta | Off | Off |
xdebug.trace_enable_trigger | Off | Off |
xdebug.trace_enable_trigger_value | no value | no value |
xdebug.trace_format | 0 | 0 |
xdebug.trace_options | 0 | 0 |
xdebug.trace_output_dir | /tmp | /tmp |
xdebug.trace_output_name | trace.%c | trace.%c |
xdebug.var_display_max_children | 128 | 128 |
xdebug.var_display_max_data | 512 | 512 |
xdebug.var_display_max_depth | 3 | 3 |
###windows側
- c:\windows\system32\drivers\hostsを編集
- vscodeをインストール
- PHP debugをインストール
- C:\Users\nullbot\ubuntu/www/appsをvscodeで開く
launch.jsonは以下の通り
{ // IntelliSense を使用して利用可能な属性を学べます。 // 既存の属性の説明をホバーして表示します。 // 詳細情報は次を確認してください: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "Listen for XDebug", "type": "php", "request": "launch", "port": 9000, "serverSourceRoot": "/home/nullbot/ubuntu/www/apps", "localSourceRoot": "${workspaceRoot}", } ] }
/var/log/xdebug にはログは出力されていませんでした。9000番ポートが開いてないかと思い、9010番に変更しましたが駄目。コマンドプロンプト, WSL上でnetcatを使った疎通では通信できていました。
##追記
launch.jsonに"log":trueを加えてログを出しました。
<- launchResponse Response { seq: 0, type: 'response', request_seq: 2, command: 'launch', success: true } new connection 1 <- threadEvent ThreadEvent { seq: 0, type: 'event', event: 'thread', body: { reason: 'started', threadId: 1 } } <- initializedEvent InitializedEvent { seq: 0, type: 'event', event: 'initialized' } -> threadsRequest { command: 'threads', type: 'request', seq: 3 } <- threadsResponse Response { seq: 0, type: 'response', request_seq: 3, command: 'threads', success: true, body: { threads: [ Thread { id: 1, name: 'Request 1 (14:50:12)' } ] } } -> setBreakpointsRequest { command: 'setBreakpoints', arguments: { source: { name: 'Reserve.php', path: 'c:\Users\nullbot\ubuntu\www\apps\application\modules\admin\controllers\Reserve.php' }, lines: [ 16 ], breakpoints: [ { line: 16 } ], sourceModified: false }, type: 'request', seq: 4 } <- setBreakpointsResponse Response { seq: 0, type: 'response', request_seq: 4, command: 'setBreakpoints', success: true, body: { breakpoints: [ { verified: true, line: 16 } ] } } -> setFunctionBreakpointsRequest { command: 'setFunctionBreakpoints', arguments: { breakpoints: [] }, type: 'request', seq: 5 } <- setFunctionBreakpointsResponse Response { seq: 0, type: 'response', request_seq: 5, command: 'setFunctionBreakpoints', success: true, body: { breakpoints: [] } } -> setExceptionBreakpointsRequest { command: 'setExceptionBreakpoints', arguments: { filters: [] }, type: 'request', seq: 6 } <- setExceptionBreakpointsResponse Response { seq: 0, type: 'response', request_seq: 6, command: 'setExceptionBreakpoints', success: true } -> configurationDoneRequest { command: 'configurationDone', type: 'request', seq: 7 } -> threadsRequest { command: 'threads', type: 'request', seq: 8 } <- threadsResponse Response { seq: 0, type: 'response', request_seq: 8, command: 'threads', success: true, body: { threads: [ Thread { id: 1, name: 'Request 1 (14:50:12)' } ] } } <- configurationDoneResponse Response { seq: 0, type: 'response', request_seq: 7, command: 'configurationDone', success: true } <- threadEvent ThreadEvent { seq: 0, type: 'event', event: 'thread', body: { reason: 'exited', threadId: 1 } } new connection 2 <- threadEvent ThreadEvent { seq: 0, type: 'event', event: 'thread', body: { reason: 'started', threadId: 2 } } <- initializedEvent InitializedEvent { seq: 0, type: 'event', event: 'initialized' } -> threadsRequest { command: 'threads', type: 'request', seq: 9 } <- threadsResponse Response { seq: 0, type: 'response', request_seq: 9, command: 'threads', success: true, body: { threads: [ Thread { id: 2, name: 'Request 2 (14:50:12)' } ] } } -> setBreakpointsRequest { command: 'setBreakpoints', arguments: { source: { name: 'Reserve.php', path: 'c:\Users\nullbot\ubuntu\www\apps\application\modules\admin\controllers\Reserve.php' }, lines: [ 16 ], breakpoints: [ { line: 16 } ], sourceModified: false }, type: 'request', seq: 10 } <- setBreakpointsResponse Response { seq: 0, type: 'response', request_seq: 10, command: 'setBreakpoints', success: true, body: { breakpoints: [ { verified: true, line: 16 } ] } } -> setFunctionBreakpointsRequest { command: 'setFunctionBreakpoints', arguments: { breakpoints: [] }, type: 'request', seq: 11 } <- setFunctionBreakpointsResponse Response { seq: 0, type: 'response', request_seq: 11, command: 'setFunctionBreakpoints', success: true, body: { breakpoints: [] } } -> setExceptionBreakpointsRequest { command: 'setExceptionBreakpoints', arguments: { filters: [] }, type: 'request', seq: 12 } <- setExceptionBreakpointsResponse Response { seq: 0, type: 'response', request_seq: 12, command: 'setExceptionBreakpoints', success: true } -> configurationDoneRequest { command: 'configurationDone', type: 'request', seq: 13 } -> threadsRequest { command: 'threads', type: 'request', seq: 14 } <- threadsResponse Response { seq: 0, type: 'response', request_seq: 14, command: 'threads', success: true, body: { threads: [ Thread { id: 2, name: 'Request 2 (14:50:12)' } ] } } <- configurationDoneResponse Response { seq: 0, type: 'response', request_seq: 13, command: 'configurationDone', success: true } <- threadEvent ThreadEvent { seq: 0, type: 'event', event: 'thread', body: { reason: 'exited', threadId: 2 } }
回答2件
あなたの回答
tips
プレビュー