文档:Hyperf文档Hyperf框架官方文档 https://hyperf.wiki/2.2/#/zh-cn/db/querybuilder
一:准备环境
基于宝塔环境,安装php7.4,
Hyperf 2.2 需要PHP版本 >= 7.3,推荐使用7.4以上的版本。
删掉禁用函数

安装需要的扩展:redis,和 swoole4


?手动安装pcntl扩展:
进入pcntl所在的目录
cd /www/server/php/74/src/ext/pcntl
执行下面命令,安装
/www/server/php/74/bin/phpize
./configure --with-php-config=/www/server/php/74/bin/php-config
make && make install
安装完,建议看一下是不是enabled
<?php
phpinfo();

?通过 Composer 创建项目
composer create-project hyperf/hyperf-skeleton
composer install
启动项目
cd hyperf-skeleton
php bin/hyperf.php start
如果有报错,请查看php版本
php -v
看看是不是7.4
[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.
ERROR Swoole short function names must be disabled before the server starts, please set swoole.use_shortname='Off' in your php.ini.
去php.ini 加一行
swoole.use_shortname=Off
|