搭建docker+swoole+php7 的环境
来源:互联网 发布:淘宝上买书可靠吗 编辑:程序博客网 时间:2024/05/21 08:01
最近在学习swoole php扩展,苦恼于其运行环境不能在win系统下运行, 但开发代码一直在win系统上,很无奈,,,,
所以就用docker来代替,舒服~
有很多相关docker的swoole镜像,很多都是基于ubuntn或centos的基础上创建的,不好的地方就是镜像体积太大了,而alpine的很小.经过不断地google,终于找到一位大神创建的docker, 很好用~~~~
以下是我的经历和填了一个坑
缩主机: Centos7
缩主机: Centos7 #file: test_swoole_server.php<?php$http = new swoole_http_server("0.0.0.0", 9501);//注意,不是127.0.0.1 而是 0.0.0.1$http->on("start", function ($server) { echo "Swoole http server is started at http://127.0.0.1:9501\n";});$http->on("request", function ($request, $response) { $response->header("Content-Type", "text/plain"); $response->end("Hello World\n".json_encode(['hello'=>'nihao'.time()]));});$http->start();
docker 镜像,此镜像包括很多php扩展,例如json: https://github.com/cmptech/auto_cmp_php_docker_server
[PHP Modules]bcmathbz2calendarCorectypecurldatedomexiffileinfofilterftpgettextgmphashiconvimapjsonlibxmlmbstringmcryptmemcachedmongodbmysqlimysqlndodbcopensslpcntlpcrePDOpdo_dblibpdo_mysqlPDO_ODBCpdo_pgsqlpdo_sqlitepgsqlPharposixreadlineredisReflectionsessionshmopSimpleXMLsnmpsoapsocketsSPLsqlite3ssh2standardswoolesysvmsgsysvsemsysvshmtidytimezonedbtokenizerxmlxmlreaderxmlwriterxslZend OPcachezipzlib[Zend Modules]Zend OPcache
#运行容器, 映射端口:9501 ,存储卷 缩主机当前目录 : 容器 /root ,准备好后#运行 php7 /root/test_swoole_server.phpdocker run -ti -p 9501:9501 -v `pwd`:/root/ -d cmptech/auto_cmp_php_docker_server php7 /root/test_swoole_server.php
结果显示
[root@localhost yangqinjiang]# curl http://127.0.0.1:9501Hello World{"hello":"nihao1508839506"}
留意selinux的限制
阅读全文
0 0
- 搭建docker+swoole+php7 的环境
- ubuntu server 搭建apache + php7 + mysql + swoole框架环境
- ubuntu server 搭建apache + php7 + mysql + swoole框架环境
- Windows下使用swoole的环境搭建
- linux+php7+swoole搭建及时通讯
- Linux上php7环境的搭建 Lamp
- mac 下 swoole 环境搭建
- Linux下swoole环境搭建
- Linux下swoole环境搭建
- ubuntu搭建php7环境
- LANP环境搭建(PHP7)
- PHP7 Windows10环境搭建
- 基于docker的环境搭建
- 五分钟利用docker搭建好php7.0.10+nginx服务环境
- PHP7与Swoole
- linux下PHP7环境搭建
- win7(64) php7环境搭建
- Windows7 搭建 PHP7 运行环境
- 多线程池newFixedThreadPool之动态多线程池做线程池隔离
- Google Sample android-architecture kotlin 分析
- 两个时间相减
- Redis能干啥?细看11种Web应用场景
- 用MySQL实现组内随机采样
- 搭建docker+swoole+php7 的环境
- 【常见问题】web开发中浏览器缓存问题
- java异常处理
- 关于Error:Execution failed for task ':Disentanglement:transformNative_libsWithStripDebugSymbolForDebug
- 使用 EXPLAIN PLAN 获取SQL语句执行计划
- Maven构建项目报错解决办法
- python3 编码与解码问题
- 用python测试连接rabiitmq的简单通讯
- 高通Camera 驱动调试要点(一)