当前位置: 首页 > 后端技术 > PHP

Swoole-Cli5.0.1:PHP二进制发行版

时间:2023-03-29 20:16:56 PHP

Swoole-Cli简介Swoole-Cli是一个集成了swoole、phpcore、php-cli、php-fpm和几个常用扩展的PHP二进制发行版。Swoole-Cli全部静态编译打包,不依赖任何操作系统的so动态链接库,具有很好的移植性,可以在任何Linux系统之间复制,下载后即可使用。GitHub:https://github.com/swoole/swoole-cli操作系统Swoole-Cli将提供Linux、macOS、Windows(Cygwin)3种操作系统的二进制包支持。Windows环境推荐使用WSL。主要更新PHP,同步到8.1.12版本。添加mongodb扩展并集成clihttpserver和php-fpm下载安装。下载地址:linuxx64:https://wenda-1252906962.file.myqcloud.com/dist/swoole-cli-v5.0.1-linux-x64.tar.xz直接下载下来放在/usr/bin目录下,并设置运行,只需chmod+x/usr/bin/swoole-cli。在终端执行:swoole-cli-vswoole-cli-m替换PHP软链接Swoole-Cli到php,替换PHPln-s/usr/bin/swoole-cli/usr/bin/phpphp-v#installcomposercurl-sShttps://getcomposer.org/installer|php配置文件swoole-cli默认不加载任何php.ini配置文件。您可以使用-d参数设置PHP选项或使用-c参数指定要加载的php.ini配置文件。swoole-cli-dswoole.use_shortname=offbin/hyperf.phpstartswoole-cli-c/tmp/php.ini-v启动PHP-FPMswoole-cli集成了PHP-FPM,可以使用-P命令启动fpm.#查看帮助文件swoole-cli-P-h#运行FPMswoole-cli-P--fpm-config/opt/php-8.1/etc/php-fpm.conf-p/opt/php-8.1/var#关闭守卫进程swoole-cli-P--fpm-config/opt/php-8.1/etc/php-fpm.conf-p/opt/php-8.1/var-F#使用root账号启动swoole-cli-P--fpm-config/opt/php-8.1/etc/php-fpm.conf-p/opt/php-8.1/var-F-R启动CLIServer#使用LaravelArtisan工具swoole-cliartisanserve#启动CLIServerswoole-cli-S127.0.0.1:9001启动SwooleServerserver.php$http=newSwoole\Http\Server('127.0.0.1',9501);$http->on('start',function($server){echo"Swoolehttpserverisstartedathttp://127.0.0.1:9501\n";});$http->on('request',function($request,$response){$response->header('Content-Type','text/plain');$response->end('HelloWorld');});$http->start();执行swoole-cliserver.php扩展列表htf@htf-ThinkPad-T470p:~/workspace/cli-swoole$./bin/swoole-cli-m[PHPModules]bcmathbz2CorectypecurldatedomexiffileinfofiltergdgmphashiconvimagickintljsonlibxmlmbstringmongodbmysqlimysqlndopensslpcntlpcrePDOpdo_mysqlpdo_sqlitePharposixredisReflectionsessionSimpleXMLsoapsocketssodiumSPLsqlite3standardswooletokenizerxmlxmlreaderxmlwriterxslyamlzipzlib[Zend模块]

最新推荐
猜你喜欢