ha-ni-cc / hyperf-watch Goto Github PK
View Code? Open in Web Editor NEW🚀 Hyperf Watch Hot Reload Scripts 😊 Make Coding More Happy 👉 监听文件变化自动重启Hyperf
🚀 Hyperf Watch Hot Reload Scripts 😊 Make Coding More Happy 👉 监听文件变化自动重启Hyperf
➜ hyperf-skeleton php watch
🚀 Start @ 2020-02-26 13:40:16
📡 Watching 35 files...
Notice: Use of undefined constant SWOOLE_HOOK_ALL - assumed 'SWOOLE_HOOK_ALL' in /Users/nick/document/code/www/myself/hyperf/hyperf-skeleton/bin/hyperf.php on line 11
Scanning app ...
Fatal error: Declaration of App\Listener\DbQueryExecutedListener::process(App\Listener\object $event) must be compatible with Hyperf\Event\Contract\ListenerInterface::process(Hyperf\Event\Contract\object $event) in /Users/nick/document/code/www/myself/hyperf/hyperf-skeleton/app/Listener/DbQueryExecutedListener.php on line 27
建议:
将log_level的级别调至SWOOLE_LOG_INFO或者以上。
场景:
我编译的swoole,是开启了debug和trace输出的,在执行大佬你的watch命令时,打印了一堆trace日志,我觉得,这种日志,我一个使用者应该没必要看到吧?
[root@localhost api]# php watch -c
?? Start @ 2020-06-11 06:54:06
?? Watching 78 files...
rm -rf ./runtime/container/proxy
..
Detected an available cache, skip the app scan process.
Detected an available cache, skip the vendor scan process.
[INFO] Worker#1 started.
[INFO] Worker#0 started.
[INFO] HTTP Server listening at 0.0.0.0:9501
[INFO] Worker#2 started.
[INFO] Worker#3 started.
[INFO] Process[queue.default.0] start.
?? Restart @ 2020-06-11 06:54:31
?? Watching 78 files...
rm -rf ./runtime/container/proxy
..
Scanning app ...
Scan app completed, took 1277.706861496 milliseconds.
Detected an available cache, skip the vendor scan process.
[INFO] Worker#1 started.
[INFO] Worker#0 started.
[INFO] HTTP Server listening at 0.0.0.0:9501
[INFO] Worker#2 started.
[INFO] Worker#3 started.
[INFO] Process[queue.default.0] start.
?? Restart @ 2020-06-11 06:54:39
PHP Warning: Swoole\Event::add(): already exist in xxx/api/watch on line 67
?? Watching 78 files...
rm -rf ./runtime/container/proxy
..
Scanning app ...
Scan app completed, took 1277.7030467987 milliseconds.
Detected an available cache, skip the vendor scan process.
[INFO] Worker#1 started.
[INFO] Worker#0 started.
[INFO] HTTP Server listening at 0.0.0.0:9501
[INFO] Worker#2 started.
[INFO] Worker#3 started.
[INFO] Process[queue.default.0] start.
[NOTICE]
TIME:2020-06-11 02:55:11
PERMS:sys:user:list
IP:192.168.33.1
?? Restart @ 2020-06-11 06:55:11
PHP Warning: Swoole\Event::add(): already exist in xxx/watch on line 67
?? Watching 78 files...
版本:2.1
情况描述:控制器中通过$this->request->input来获取参数,启动监听后获取不了参数,如果用原生的启动是没有问题的
错误情况:
[DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\Config\Listener\RegisterPropertyHandlerListener listener. [DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\ExceptionHandler\Listener\ErrorExceptionHandler listener. [DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\ExceptionHandler\Listener\ExceptionHandlerListener listener. [DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\DbConnection\Listener\RegisterConnectionResolverListener listener. [DEBUG] Event Hyperf\Framework\Event\BeforeMainServerStart handled by Hyperf\Process\Listener\BootProcessListener listener. [DEBUG] Event Hyperf\Framework\Event\OnStart handled by Hyperf\Server\Listener\InitProcessTitleListener listener. [INFO] Worker#0 started. [INFO] HTTP Server listening at 0.0.0.0:9501 [DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\AfterWorkerStartListener listener. [DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\InitProcessTitleListener listener. [DEBUG] Event Hyperf\Framework\Event\OnManagerStart handled by Hyperf\Server\Listener\InitProcessTitleListener listener. [INFO] Worker#1 started. [DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\AfterWorkerStartListener listener. [DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\InitProcessTitleListener listener. [ERROR] Call to a member function input() on null[34] in /data/wwwroot/hyperf-skeleton/app/Controller/IndexController.php [ERROR] #0 /data/wwwroot/hyperf-skeleton/vendor/hyperf/http-server/src/CoreMiddleware.php(161): App\Controller\IndexController->verifyCode()
控制器代码片段
public function verifyCode() { $uuid = $this->request->input('uuid', ''); if(empty($uuid)) { return ['code' => 500, 'msg' => 'uuid is empty', 'data' => []]; } }
个人觉得 filemtime 可能比 md5 要好些,快5倍的样子
目前用起来挺方便的,就是遇到一个问题,如果我在修改blade模版,也会触发reload动作,然后我就得等待3秒等它完成reload,可以过滤掉自定义文件后缀的文件监控吗
更新了最新的hf版本
多次修改代码以后提示这个,然后导致服务直接无法响应
Warning: Swoole\Event::add(): already exist in /var/www/bravo-encode-api/watch.php on line 114
将swoole-cli改名成php并放入环境变量后,执行php watch提示如下错误:
Deprecated: Return type of Filter::accept() should either be compatible with FilterIterator::accept(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /mnt/d/phpstudy_pro/WWW/hyperf-test/watch on line 224
🚀 Start @ 2022-07-23 03:33:23
Fatal error: Uncaught ArgumentCountError: posix_kill() expects exactly 2 arguments, 1 given in /mnt/d/phpstudy_pro/WWW/hyperf-test/watch:83
Stack trace:
#0 /mnt/d/phpstudy_pro/WWW/hyperf-test/watch(83): posix_kill('396')
#1 /mnt/d/phpstudy_pro/WWW/hyperf-test/watch(102): killOldProcess()
#2 /mnt/d/phpstudy_pro/WWW/hyperf-test/watch(75): start()
#3 {main}
thrown in /mnt/d/phpstudy_pro/WWW/hyperf-test/watch on line 83
保持终端颜色输出?
颜色有利于快速分辨日志
RT
cup的使用率一直占用30%,导致电脑容易发热,建议优化下,比入适当的加些休眠时间
测试环境和生产环境在一台机器上,生产环境用的 php bin/hyperf.php start,测试环境 php watch -c 如果后执行会把生产环境的服务也会kill掉,不太明白为啥,看watch脚本里的 killOldProcess 方法也是杀当前进程,希望作者解惑一下
Start @ 2021-05-06 16:46:13
Watching 35 files...
PHP Deprecated: Swoole\Event::rshutdown(): Event::wait() in shutdown function is deprecated in Unknown on line 0
Deprecated: Swoole\Event::rshutdown(): Event::wait() in shutdown function is deprecated in Unknown on line 0
无法访问此网站找不到 raw.githubusercontent.com 的服务器 IP 地址。
尝试运行 Windows 网络诊断。
DNS_PROBE_FINISHED_NXDOMAIN
环境 ubuntu homestead
hyperf 版本 1.0
启动什么的都是正常。但是日志报错
Scanning ...
Scan completed.
[DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\Di\Listener\BootApplicationListener listener.
[DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\Config\Listener\RegisterPropertyHandlerListener listener.
[DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\Paginator\Listener\PageResolverListener listener.
[2019-10-08 16:33:47 @13188.0] WARNING swSocket_bind(:434): bind(0.0.0.0:9501) failed, Error: Address already in use[98]
In Server.php line 169:
failed to listen server port[0.0.0.0:9501], Error: Address already in use[9
8]
start
换一个端口,报错一个。
请求支持回调函数
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.