初次使用hyperf注意事项

作为php开发人员,学习一下swoole是有必要的

平时一直用laravel框架,于是选择了hyperf,据说很多用法一样

开始

首先,不把大量的时间花在配置上,于是安装宝塔面板,安装了`php7.4`

同时安装php扩展`Swoole4`

接着点击禁用函数

将以下函数删除

```
putenv

proc_open

pcntl_fork

pcntl_wait

```

然后执行

`composer create-project hyperf/hyperf-skeleton `

一路回车

然后

```
cd hyperf-skeleton
[root@iZbp13ph356ra22ldly01lZ hyperf-skeleton]# php bin/hyperf.php start
```

以下为运行结果

```
[DEBUG] Event Hyperf\Framework\Event\BootApplication handled by Hyperf\Config\Listener\RegisterPropertyHandlerListener 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\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.
[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.
```

将`swoole.use_shortname=off`添加到`php.ini`

特别强调,关闭防火墙,放行`9501`号端口

    A+
发布日期:2021年12月27日  所属分类:未分类

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: