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)
Start — settings — update and security — developer options — developer mode. When you come out of the confirmation dialog box, select Yes.
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.
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
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
Before installing the spool extension, make sure that the following software has been installed
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
Other tools can install this method.
SwooleThe project has been included in
PHPThe official extension library can be
peclCommand, one click download installation
pecl install swoole
(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 the
php -mTo see if it was loaded successfully
swoole.soIf not, it could be
php.iniThe path of is not right.
have access to
php --iniTo locate
php.iniThe absolute path of,
Loaded Configuration FileOne shows the loaded php.ini file, if the value is
noneThe proof doesn’t load anything at all
php.iniFile, need to create their own.
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
If this prompt also appears, it means that running hyperf through the subsystem is successful
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
After configuration, reopen the phpstorm editor as follows:
Indicates that the phpstorm editor is set successfully. Students can enter PHP bin / hyperf. PHP start
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