** This article has participated in the “Digitalstar Project” and won a creative gift package to challenge the creative incentive money. **
The Swoole framework is an amazing framework that makes up for some of the shortcomings of PHP itself. Swoole is actually a PHP extension written in C, and it doesn’t work on Windows, which is still the most popular programming environment. So how do you develop a Swoole extension on Windows? Of course we could use the VM to create a virtual machine and build a Linux environment, but to do so we would have to either write code in the virtual machine or copy it to the virtual machine after Windows is written. For me, I thought it was too much trouble, so I asked Baidu and found cgywin. I quoted the introduction of “Cygwin is a Unix-like simulation environment running on Windows platform” from Baidu Encyclopedia. Since it is a simulation environment, it is easy to handle! So let’s start talking about how do you set up a swoole environment
download
Cgywin address: www.cygwin.com/. Note here to download the pair of versions
Domestic mirror:
1) FTP:ftp://ftp.sjtu.edu.cn/sites/cygwin.com/pub/cygwin/ of Shanghai jiaotong university
2) A mirror of 163: mirrors.163.com/cygwin/
3) mirrors.sohu.com/cygwin/
Swoole address: github.com/swoole/swoo… Download the tar.gz version
Install cgywin
Click next
Go ahead and click next
The installation directory and download directory above are your own Settings. The next step is to select the mirror address as shown in the figure. I chose this one, but when you use it, you may not be sure, but don’t worry, one of these will definitely work
The next step is to select pre-installed software, which you will need to install since you are running the PHP environment
Extension package 1: GCC: gcc-core
Extension package 2: PHP: PHP, php-devel
Libpcre devel: libpcre devel: libpcre devel: libpcre devel
Extension Pack 4: Autoconf
C++ : gcc-objc++, libc++devel, libc++1
Extension 6: json: php-json
Extension 7: openSSL
All right! The next step is the next step! It will be a long process
Wait and wait… Until it’s done!!
Install the Swoole extension
We unzip the swoole download into cgywin’s home folder (for those of you who have used Linux, it’s deja vu!). “And then open cGYwin and go to Swoole’s directory
Then run phpize (if you did not install php-devel, this will alert you).
/configure && make && make install
Success, old tears!
After executing this command, the installation of the Swoole extension is basically successful. . Find the PHP ini files in the etc folder can also use PHP – below I | grep. PHP ini to view
Write extension=swoole.so to the php.ini file to save the file. Execute PHP -m to see if it is loaded
Window, Swoole deployment complete!
As a final test, run the swoole example:
Local test address: http://127.0.0.1:9501/