侯体宗的博客
  • 首页
  • Hyperf版
  • beego仿版
  • 人生(杂谈)
  • 技术
  • 关于我
  • 更多分类
    • 文件下载
    • 文字修仙
    • 群聊
    • 九宫格抽奖
    • 拼图
    • 消消乐
    • 相册

centos7+lnmp环境下安装Hyperf框架运行步骤流程

swoole  /  管理员 发布于 1年前   1151

准备工作

1.为了方便我直接用的lnmp环境

2.composer已安装

3.swoole扩展已安装 (具体步骤可以搜索我的博客文章)


php.ini配置文件的修改项目

1.并关闭Short Name

swoole.use_shortname=Off

2.搜索disable_functions(php中禁用函数) 并删除proc_open ,proc_get_status 函数

不然composer项目的时候会遇到以下错误

The Process class relies on proc_open, which is not available on your PHP installation.;
proc_get_status() has been disabled for security reasons;


开始安装项目 (我这里的安装目录是/home/www/)

[root@hyperf ~]# cd /home/www
[root@hyperf www]# ll
总用量 0
[root@hyperf www]# composer create-project hyperf/hyperf-skeleton
Creating a "hyperf/hyperf-skeleton" project at "./hyperf-skeleton"
Installing hyperf/hyperf-skeleton (v2.1.2)
  - Installing hyperf/hyperf-skeleton (v2.1.2): Extracting archive
Created project in /home/www/hyperf-skeleton
> @php -r "file_exists('.env') || copy('.env.example', '.env');"
> Installer\Script::install
Setting up optional packages
Setup data and cache dir
Removing installer development dependencies
  What time zone do you want to setup ?
  [n] Default time zone for php.ini
Make your selection or type a time zone name, like Asia/Shanghai (n):
n
  Do you want to use Database (MySQL Client) ?
  [y] yes
  [n] None of the above
  Make your selection or type a composer package name and version (yes): y
  - Adding package hyperf/database (~2.1.0)
  - Adding package hyperf/db-connection (~2.1.0)
  Do you want to use Redis Client ?
  [y] yes
  [n] None of the above
  Make your selection or type a composer package name and version (yes): y
  - Adding package hyperf/redis (~2.1.0)
  - Copying config/autoload/redis.php
  Which RPC protocol do you want to use ?
  [1] JSON RPC with Service Governance
  [2] JSON RPC
  [3] gRPC
  [n] None of the above
  Make your selection or type a composer package name and version (n): n
  Which config center do you want to use ?
  [1] Apollo
  [2] Aliyun ACM
  [3] ETCD
  [n] None of the above
  Make your selection or type a composer package name and version (n): n
  Do you want to use hyperf/constants component ?
  [y] yes
  [n] None of the above
  Make your selection (n): y
  - Adding package hyperf/constants (~2.1.0)
  - Copying app/Constants/ErrorCode.php
  - Copying app/Exception/BusinessException.php
  Do you want to use hyperf/async-queue component ? (A simple redis queue component)
  [y] yes
  [n] None of the above
  Make your selection or type a composer package name and version (n): y
  - Adding package hyperf/async-queue (~2.1.0)
  - Copying config/autoload/async_queue.php
  - Copying app/Process/AsyncQueueConsumer.php
  - Copying app/Listener/QueueHandleListener.php
  - Copying config/autoload/redis.php
  Do you want to use hyperf/amqp component ?
  [y] yes
  [n] None of the above
  Make your selection or type a composer package name and version (n): y
  - Adding package hyperf/amqp (~2.1.0)
  - Copying config/autoload/amqp.php
  Do you want to use hyperf/model-cache component ?
  [y] yes
  [n] None of the above
  Make your selection or type a composer package name and version (n): y
  - Adding package hyperf/model-cache (~2.1.0)
  - Copying app/Model/Model.php
  - Copying config/autoload/databases.php
  - Copying config/autoload/redis.php
  Do you want to use hyperf/elasticsearch component ?
  [y] yes
  [n] None of the above
  Make your selection or type a composer package name and version (n): y
  - Adding package hyperf/elasticsearch (~2.1.0)
  Do you want to use hyperf/tracer component ? (An open tracing protocol component, adapte with Zipkin etc.)
  [y] yes
  [n] None of the above
  Make your selection or type a composer package name and version (n): y
  - Adding package hyperf/tracer (~2.1.0)
  - Copying config/autoload/opentracing.php
Remove installer
Removing composer.lock from .gitignore
Removing Expressive installer classes, configuration, tests and docs
Loading composer repositories with package information
Updating dependencies
Lock file operations: 132 installs, 0 updates, 0 removals
  - Locking composer/semver (3.2.4)
...
  - Locking webmozart/assert (1.10.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 132 installs, 0 updates, 0 removals
  - Downloading doctrine/lexer (1.2.1)
...
  - Downloading swoole/ide-helper (4.6.4)
  - Installing doctrine/lexer (1.2.1): Extracting archive
...
  - Installing swoole/ide-helper (4.6.4): Extracting archive
34 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating optimized autoload files
> rm -rf runtime/container
62 packages you are using are looking for funding.
Use the `composer fund` command to find out more!


到这就是composer完项目了


启动项目

[root@hyperf ~]# cd /home/www
[root@hyperf www]# ll
总用量 4
drwxr-xr-x. 9 root root 4096 3月  24 14:55 hyperf-skeleton
[root@hyperf www]# cd hyperf-skeleton/
[root@hyperf hyperf-skeleton]# ll
总用量 364
drwxr-xr-x.  8 root root    102 3月  24 14:54 app
drwxr-xr-x.  2 root root     24 2月  22 17:38 bin
-rw-r--r--.  1 root root   2545 3月  24 14:55 composer.json
-rw-r--r--.  1 root root 343393 3月  24 14:55 composer.lock
drwxr-xr-x.  3 root root     79 2月  22 17:38 config
-rw-r--r--.  1 root root    580 2月  22 17:38 deploy.test.yml
-rw-r--r--.  1 root root   1455 2月  22 17:38 Dockerfile
-rw-r--r--.  1 root root    474 2月  22 17:38 phpstan.neon
-rw-r--r--.  1 root root    695 2月  22 17:38 phpunit.xml
-rw-r--r--.  1 root root   1797 2月  22 17:38 README.md
drwxrwxr-x.  2 root root      6 3月  24 14:49 runtime
drwxr-xr-x.  3 root root     64 2月  22 17:38 test
drwxr-xr-x. 43 root root   4096 3月  24 14:56 vendor
[root@hyperf 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\Amqp\Listener\BeforeMainServerStartListener 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.
[DEBUG] Event Hyperf\Framework\Event\MainWorkerStart handled by Hyperf\Amqp\Listener\MainWorkerStartListener 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.
[INFO] Process[queue.default.0] start.
[DEBUG] Event Hyperf\Process\Event\BeforeProcessHandle handled by Hyperf\Process\Listener\LogBeforeProcessStartListener listener.
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\AfterWorkerStartListener listener.
[DEBUG] Event Hyperf\Process\Event\BeforeProcessHandle handled by Hyperf\Server\Listener\InitProcessTitleListener listener.
[DEBUG] Event Hyperf\Framework\Event\AfterWorkerStart handled by Hyperf\Server\Listener\InitProcessTitleListener listener.


项目已启动,我们直接到访问一下

1.png



  • 上一条:
    秒杀系统的设计流程步骤,思路清晰明了,很赞的教程
    下一条:
    centos7系统上挂载另一台centos7系统服务器上的共享文件夹流程步骤
  • 昵称:

    邮箱:

    0条评论 (评论内容有缓存机制,请悉知!)
    最新最热
    • 分类目录
    • 人生(杂谈)
    • 技术
    • linux
    • Java
    • php
    • 框架(架构)
    • 前端
    • ThinkPHP
    • 数据库
    • 微信(小程序)
    • Laravel
    • Redis
    • Docker
    • Go
    • swoole
    • Windows
    • Python
    • 苹果(mac/ios)
    • 相关文章
    • 在hyperf框架中使用基于protobuf的RPC生成器实现rpc服务(0个评论)
    • hyperf + 京东联盟sdk实现简单商品列表转链跳转购买商品功能示例(0个评论)
    • Hyperf 3.0版本发布(0个评论)
    • hyperf2.2框架中添加Cache代理类的流程步骤及使用案例(0个评论)
    • hyperf2.1框架使用Dockerfile部署流程步骤(0个评论)
    • 近期文章
    • 在laravel框架中的5个HTTP客户端技巧分享(0个评论)
    • 在go语言中使用FFmpeg库实现PCM音频文件编码为mp3格式文件流程步骤(0个评论)
    • gopacket免安装Pcap实现驱动层流量抓包流程步骤(0个评论)
    • 在laravel项目中实现密码强度验证功能推荐扩展包:password-strength(0个评论)
    • 在go语言中用filepath.Match()函数以通配符模式匹配字符串示例(0个评论)
    • Laravel Response Classes 响应类使用优化浅析(0个评论)
    • mysql中sql_mode的各模式浅析(0个评论)
    • 百度文心一言今天发布,个人第一批内测体验记录,不好别打我(0个评论)
    • 嘿加密世界让我们谈谈在共识中将中本聪主流化(0个评论)
    • 在go语言中寻找两个切片或数组中的相同元素/共同点/交集并集示例代码(0个评论)
    • 近期评论
    • 博主 在

      2023年国务院办公厅春节放假通知:1月21日起休7天中评论 @ xiaoB 你只管努力,剩下的叫给天意;天若有情天亦老,..
    • xiaoB 在

      2023年国务院办公厅春节放假通知:1月21日起休7天中评论 会不会春节放假后又阳一次?..
    • BUG4 在

      你翻墙过吗?国内使用vpn翻墙可能会被网警抓,你需了解的事中评论 不是吧?..
    • 博主 在

      go语言+beego框架中获取get,post请求的所有参数中评论 @ t1  直接在router.go文件中配就ok..
    • Jade 在

      如何在MySQL查询中获得当月记录中评论 Dear zongscan.com team, We can skyroc..
    • 2017-09
    • 2020-03
    • 2020-06
    • 2021-03
    • 2021-04
    • 2021-05
    • 2021-07
    • 2021-08
    • 2021-09
    • 2021-11
    • 2022-03
    • 2022-05
    • 2023-01
    • 2023-02
    • 2023-03
    Top

    Copyright·© 2019 侯体宗版权所有· 粤ICP备20027696号 PHP交流群

    侯体宗的博客