Can’t stand the waiting time of hyperf startup in docker environment, teach you how to run hyperf quickly through win10 subsystem

Time:2021-6-20

In the process of using the hyperf framework, do you encounter the same trouble as me, that is, every time you start the hyperf framework through the docker, you need to wait for several seconds, sometimes even longer. By looking up the information on the Internet, I have found an effective solution, which can greatly improve the corresponding speed of hyperf startup and shorten the waiting time. Now I share it with you, If you have any questions, please ask in the comments section:

1、 Turn on win10 subsystem

a. View system version number

Press win (keyboard window key) + R, enter the winver command, the system version number information will appear, my system version number is 18363.836 (Note: version number is more than 14316)

Can't stand the waiting time of hyperf startup in docker environment, teach you how to run hyperf quickly through win10 subsystem

b. System setup before installation

Start — settings — update and security — developer options — developer mode. When you come out of the confirmation dialog box, select Yes.

Can't stand the waiting time of hyperf startup in docker environment, teach you how to run hyperf quickly through win10 subsystem

c. Enable windows subsystem settings for Linux

Click the upper left corner to return to the settings page, select: Application > programs and functions > enable or disable windows functions > select the windows subsystem applicable to Linux in the dialog box

It takes a little while to set up.

Can't stand the waiting time of hyperf startup in docker environment, teach you how to run hyperf quickly through win10 subsystem

d. Download and install Linux system

Start menu – open the Microsoft Store – enter Linux in the search box – Find – select Ubuntu – install (download and install take a while) – start after installation

Can't stand the waiting time of hyperf startup in docker environment, teach you how to run hyperf quickly through win10 subsystem

Can't stand the waiting time of hyperf startup in docker environment, teach you how to run hyperf quickly through win10 subsystem

2、 Setup of Ubuntu system

After the system is started, the user name and password will be set first. Note: the password will not be displayed in the process of input. Actually, it has been successfully entered. Enter after the input

Then set the password of the root user. It is best to:Combination of numbers and upper and lower case letters

Then enter Su and password, switch to root and upgrade apt

At this point, Linux has been enabled successfully. The next step is to set up the optimization operation steps

Can't stand the waiting time of hyperf startup in docker environment, teach you how to run hyperf quickly through win10 subsystem

Can't stand the waiting time of hyperf startup in docker environment, teach you how to run hyperf quickly through win10 subsystem

Can't stand the waiting time of hyperf startup in docker environment, teach you how to run hyperf quickly through win10 subsystem

Can't stand the waiting time of hyperf startup in docker environment, teach you how to run hyperf quickly through win10 subsystem

Can't stand the waiting time of hyperf startup in docker environment, teach you how to run hyperf quickly through win10 subsystem

3、 Configuring the hyperf environment

a. Install the spool extension

Before installing the spool extension, make sure that the following software has been installed

  • php-7.1Or later
  • gcc-4.8Or later
  • make
  • autoconf

    Recommended apt command management software package, for example, Download php7.4:

    First, use the apt search php7.4 command to search for software packages. The system will list all php software packages, find the packages to be downloaded, and execute apt install php7.4 (if root needs to add sudo in front of the command) to install them

Can't stand the waiting time of hyperf startup in docker environment, teach you how to run hyperf quickly through win10 subsystem

Can't stand the waiting time of hyperf startup in docker environment, teach you how to run hyperf quickly through win10 subsystem

Other tools can install this method.

SwooleThe project has been included inPHPThe official extension library can bePHPOfficialpeclCommand, one click download installation

pecl install swoole

Can't stand the waiting time of hyperf startup in docker environment, teach you how to run hyperf quickly through win10 subsystem

(because my computer has installed spoole, it prompts that it has been installed.)

Add spool to php.ini

Finally, after the compilation and installation is successful, modify thephp.inijoin

adoptphp -mTo see if it was loaded successfullyswoole.soIf not, it could bephp.iniThe path of is not right.

Can't stand the waiting time of hyperf startup in docker environment, teach you how to run hyperf quickly through win10 subsystem

have access tophp --iniTo locatephp.iniThe absolute path of,Loaded Configuration FileOne shows the loaded php.ini file, if the value isnoneThe proof doesn’t load anything at allphp.iniFile, need to create their own.

b. Install hyperf

Hyperf uses composer to manage project dependencies. Before using hyperf, make sure that composer is installed in your running environment.

hyperf/hyperf-skeletonThe project is a skeleton project that we have prepared for you. It has built-in some common components and related configuration files and structures. It is a web project foundation that can be used for business development quickly. During installation, you can choose component dependencies according to your own needs.

Execute the following command to create a hyperf skeleton project in its current location

composer create-project hyperf/hyperf-skeleton

Go to the hyperf skeleton project directory and start hyperf

php bin/hyperf.php start

Can't stand the waiting time of hyperf startup in docker environment, teach you how to run hyperf quickly through win10 subsystem

If this prompt also appears, it means that running hyperf through the subsystem is successful

3、 Configure to phpstorm

If you want to start hyperf directly in the editor after modifying the code in the phpstorm editor, you can open phpstorm – > file – > setting to find the terminal configuration under tools as follows

Can't stand the waiting time of hyperf startup in docker environment, teach you how to run hyperf quickly through win10 subsystem

After configuration, reopen the phpstorm editor as follows:

Can't stand the waiting time of hyperf startup in docker environment, teach you how to run hyperf quickly through win10 subsystem

Indicates that the phpstorm editor is set successfully. Students can enter PHP bin / hyperf. PHP start

Start hyperf;

Can't stand the waiting time of hyperf startup in docker environment, teach you how to run hyperf quickly through win10 subsystem

It can be compared that it is consistent with the previous Ubuntu command window, indicating that the configuration is successful.

Running the hyperf framework by installing Ubuntu directly in the win10 subsystem can greatly improve the starting time of the framework, and it is simpler and more convenient than installing it through the docker container, which is a better solution.

This work adoptsCC agreementReprint must indicate the author and the link of this article

Recommended Today

Programming Xiaobai must understand the network principle

How is the network composed? Why can we easily surf the Internet now?Whether you are a computer major or not, you may always have such questions in your heart!And today we will solve this matter and tell you the real answer! Basic composition of network First, let’s look at this sentence Connect all computers together […]