Home  >  Article  >  PHP Framework  >  The latest swoole-cli can support Windows environment!

The latest swoole-cli can support Windows environment!

WBOY
WBOYforward
2022-02-25 16:15:244871browse

This article brings you the relevant implementation steps for swoole-cli to support the Windows environment. The latest swoole-cli supports the Windows environment and is based on cygwin64. You can download it and use it. I hope it will be helpful to everyone.

The latest swoole-cli can support Windows environment!

Recommended learning: swoole video tutorial

The latest swoole-cli supports Windows environment and is implemented based on cygwin64. Download and use.

Download

A newly installed Windows machine (must be a 64-bit system) does not need to install any php related Software package, you can directly download the executable program zip compressed package of swoole-cli-cygwin64, and then unzip it to any directory.

swoole-cli is installation-free and can be used directly

Download address: https://github.com/swoole/swoole-src/releases /download/v4.8.7/swoole-cli-v4.8.7-cygwin64.zip

swoole-cli will be released simultaneously with swoole. You can download the latest version of swoole from the github release page -cli

The latest swoole-cli can support Windows environment!

To use

, you first need to configure the decompressed folder/bin directory into the system's Path environment variable.

The latest swoole-cli can support Windows environment!

The latest swoole-cli can support Windows environment!

Use win r to enter cmd to enter the Windows command line. You can use the swoole-cli command to execute the swoole or php program.

The latest swoole-cli can support Windows environment!

Extensions

swoole-cli contains various commonly used extensions, the list is as follows:

If you want to add extensions To swoole-cli, you can submit an issue on the official github homepage of swoole

The PHP version used by swoole-cli is 8.1.1

D:\>swoole-cli -m
[PHP Modules]
bcmath
bz2
Core
ctype
curl
date
dom
exif
fileinfo
filter
gd
gmp
hash
iconv
imagick
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
redis
Reflection
session
SimpleXML
soap
sockets
sodium
SPL
sqlite3
standard
swoole
tokenizer
xml
xmlreader
xmlwriter
xsl
yaml
zip
zlib
[Zend Modules]

Start the Web server

Write the simplest Web service for testing. The file name is server.php:

<?php
$http = new Swoole\Http\Server(&#39;127.0.0.1&#39;, 9501, SWOOLE_BASE);
$http->on(&#39;start&#39;, function ($server) {
    echo "Swoole http server is started at http://127.0.0.1:9501\n";
});
$http->on(&#39;request&#39;, function ($request, $response) {
    $response->header(&#39;Content-Type&#39;, &#39;text/plain&#39;);
    $response->end(&#39;Hello World&#39;);
});
$http->start();

Run:

The latest swoole-cli can support Windows environment!

Open the browser and enter http:// You can see the results at 127.0.0.1:9501/.

The latest swoole-cli can support Windows environment!

Recommended learning: swoole tutorial

The above is the detailed content of The latest swoole-cli can support Windows environment!. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:Swoole官方公众号. If there is any infringement, please contact admin@php.cn delete