Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Explain in detail the complete use examples of developing hyperf under Docker

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Hyperf official website

Installation of Hyperf official documentation

1. Docker usage

Docker search lists the hyperf image docker pull downloads the image to the local running image and mounts the directory to the folder under the current directory, and runs it into the hyperf-skeleton directory in the way of / bin/sh. This directory is $docker search hyperf$ docker pull hyperf/hyperf$ docker run-v $PWD/:/hyperf-skeleton-p 9501-it-- entrypoint / bin/sh hyperf/hyperf$ cd hyperf-skeleton attached locally.

two。 After the image container is running, install Composer in the container

First download Composer into the docker container

$wget https://mirrors.aliyun.com/composer/composer.phar

3. Modify execution permissions

The purpose of this operation is to resolve the restriction that Composer does not allow root permissions to execute.

When switching users at the same time, you can operate directly.

777 authorization is not recommended in production environment.

$chmod-R 777. / composer.phar

4. Move composer to the bin directory and rename it to composer

777 authorization is not recommended in production environment.

$mv composer.phar / usr/local/bin/composer

5. Modify root password

At the same time, because we don't know the root password, we just modify it first.

The password needs to be repeatedly entered twice and will not be displayed, please note

$passwd root

6. You can check to see if it is a linux distribution (the command will be different)

The official image is Linux's alpine.

$cat / etc/os-release

7. Create a group with a specified GID

There is a difference between alpine, which is officially mirrored as Linux, and the Centos command used by many partners.

If it is your own established image, just follow the release command.

$addgroup-g 10001-S www

8. Create a user with a specified UID

Specify shell to belong to the specified user group.

$adduser www-u 20001-D-S-s / bin/bash-G www

9. Make su available to newly created users-under root users

$chmod 4755 / bin/busybox

10. Switch to www user to execute composer

Su www switching user

Whoami View current user

$su www$ whoami

11. Set Composer image to Aliyun image to accelerate domestic download speed.

Of course, whether to use Aliyun image to see personal needs (there is no suspicion of advertising)

$composer config-g repo.packagist composer https://mirrors.aliyun.com/composer

twelve。 Install the hyperf skeleton through Composer

Choose to look at personal needs during installation!

$composer create-project hyperf/hyperf-skeleton

13. Check the configuration and other information

In general, the official source image of hyperf is configured.

The following is just an order.

View swoole

$php-- ri swoole$ php-I | grep ini

14. Write a message in php.ini

Pay special attention to the uppercase O in Off

Extension= "grpc.so" extension= "redis.so" extension= "swoole.so" swoole.use_shortname = 'Off'

15. Extensions with compatibility problems

Because Hyperf is based on Swoole protocol and the function of Swoole 4 is unprecedented in PHP, there is still a problem of compatibility with many extensions. The following extensions (including but not limited to) will cause some compatibility problems and cannot be shared or coexisted with them: xhprofxdebugblackfiretraceuopz

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report