15

とをセットphp.iniします。phpstorm イベントログで php スクリプト出力をデバッグしようとしています:Debug configphpstorm

"Error running script.php: Port 9000 is busy"

php.ini の終わり:

        [XDebug]
        zend_extension="/usr/lib/php5/20090626+lfs/xdebug.so"
        xdebug.remote_enable=1
        xdebug.remote_port="9000" (the default port is 9000)
        xdebug.profiler_enable=1
        xdebug.profiler_enable_trigger = 1
        xdebug.profiler_output_dir="/etc/php5/xdebug/profiler_output_dir"

pStorm のデバッグ ポートも 9000 に設定されています netstat -na

tcp        0      0 127.0.0.1:9000          0.0.0.0:*               LISTEN 

他のポートに設定するとどうなりますか。たとえば、設定すると10001仕事をしているようです。または、それを適切に機能させる方法。仕組みを理解しているかどうかはわかりませんxDebugDebug("script.php")(Shift+F9)ファイルにブレークポイントを設定してphpstormで実行するようなものですか?

誰かがアイデアを持っていますか?

編集:

から: http://xdebug.org/docs/remote

xdebug.remote_port
Type: integer, Default value: 9000
The port to which Xdebug tries to connect on the remote host. Port 9000 is the default for both the client and the bundled debugclient. As many clients use this port number, it is best to leave this setting unchanged.

ポートを 9000 以外に変更するとどうなりますか? 50k を超えるかもしれません。

4

7 に答える 7

5

9000ポートで実行されているプロセスの pid を lsof および netstat で識別できませんでした。一時的な最も簡単な解決策は、ポートを実際に使用されていないもの ( 10k など) に変更phpstormするphp.iniことです

于 2013-10-01T11:12:04.843 に答える
3

未来の自分へのメモ:

私の場合、これは仮想マシンのポート転送 (Virtual Box の vagrant) を使用したことが原因でした。転送9000はいいアイデアだと思いました。

10.166.53.1解決策:標準の Virtual Box である VM IP に接続します。ここに画像の説明を入力

私の内容/etc/php5/cgi/conf.d/xdebug.ini

; xdebug configuration
; xdebug.remote_host = localhost
zend_extension =  /usr/lib/php5/20121212/xdebug.so
xdebug.remote_connect_back = 1
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug.remote_handler = dbgp
xdebug.remote_mode = req
xdebug.idekey = "PHPSTORM"
xdebug.remote_log = /var/log/xdebug.log
于 2015-08-18T13:01:38.610 に答える
2

まず、少しトピックから外れていても、役立つと思います。docker-composer プロジェクトごとに異なるネットワーク インターフェイスを使用しています。このようにして、心配することなく /etc/hosts に永続的なドメイン名をマッピングできます。この例では192.168.33.102 project.domain.local.

yaml セットアップの例を次に示します。

nginx:
  build: docker-images/nginx
  links:
    - "php"
  ports:
    - "192.168.33.102:80:80"
php:
  build: docker-images/php/7.0.1-fpm
  ports:
    - "192.168.33.102:10000:9000"

PHP コンテナーは、9001をリッスンしphp7.0-fpm9000をリッスンしxdebug、ポートを公開しません。

PhpStorm デバッグ ポートはデフォルトの 9000 に設定され、サーバー ホストは192.168.33.102(または /etc/hosts の値であるproject.domain.local) に設定されます。

PHP コンテナーのポートでわかるように、別のマッピング ポートが 10000 に設定されています。PhpStorm からビジー エラーを取り除くために、9000 以外の別の値にすることができます。

また、docker-compose でポートをバインドすることも重要です。ポートをマッピングしないと機能せず、9000:9000では機能しませんでした。

それが他の誰かに役立つことを願っています!

PS: xdebug.ini は次のとおりです。

zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.remote_connect_back=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_autostart=true
于 2016-02-26T14:59:44.270 に答える