hyperf+docker+yasd+phpstorm

教程网址https://learnku.com/articles/59901

这里主要说几个坑:

1、hyperf代码版本太高phpstorm配合yasd打断点会报错:[yasd] recv command error, connection closed

2、如果程序实际上执行的是代理类,需要在代理类里面打断点,位于:runtime/container/proxy,否则打了断点也不会生效

3、程序跑在虚拟机里面

因为断点是由文件的绝对路径+行号决定的。如果虚拟机和宿主机的项目路径不一样,就会导致断点不被触发。我们需要去配置IDE的path mapping来解决这个问题

4、热更新代码调试是不生效的,不能用server:watch启动程序,需要使用 php -e bin/hyperf start 启动程序

5、使用rpc安装版本需要选择合适的版本直接 composer require hyperf/rpc-client是不行的,会报错:

Your requirements could not be resolved to an installable set of packages.

  Problem 1

    – hyperf/rpc-server[dev-master, v2.2.0-beta1, …, 2.2.x-dev] require hyperf/http-server ~2.2.0 -> found hyperf/http-server[dev-master, v2.2.0-beta1, …, 2.2.x-dev (alias of dev-master)] but it conflicts with your root composer.json require (~2.1.0).

    – hyperf/rpc-server 2.2.x-dev is an alias of hyperf/rpc-server dev-master and thus requires it to be installed too.

    – Root composer.json requires hyperf/rpc-server ^2.2 -> satisfiable by hyperf/rpc-server[v2.2.0-beta1, v2.2.0-beta2, v2.2.0, 2.2.x-dev (alias of dev-master)].

Use the option –with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

需要去github查看对应包的版本,选择较低的版本进行安装,比如这里:composer require hyperf/rpc-server:v2.1.0

发表回复

您的电子邮箱地址不会被公开。