4 Star 7 Fork 1

游鱼彩虹 / laravel_swoole

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

简介

swoole是PHP语言的高性能网络通信框架,提供了PHP语言的异步多线程服务器,异步TCP/UDP网络客户端,异步MySQL,数据库连接池,AsyncTask,消息队列,毫秒定时器,异步文件读写,异步DNS查询。 laravel是php的快速开发mvc全栈框架,开发速度一流,性能一般。 这个项目是把两则结合的一个研究项目,争取开发速度和性能都能完美吧。

安装

  1. debian8 下
  sudo apt-get install php5-dev php-pear
  1. 安装swoole
  pecl install swoole
  1. 编辑php.ini加入扩展
  extension=swoole.so
  1. 在laravel项目目录放入laravel_swoole.php
  php laravel_swoole.php

设置

由于swoole不能直接提供静态文件下载,也许是我目前没找到方法所以先用nginx来代理。

  upstream web_app {
    server 127.0.0.1:9501;
  }

  server {
      listen       80;
      server_name  localhost;
      root /home/www/web_app/public;

      #access_log  /var/log/nginx/log/host.access.log  main;

      location / {
          proxy_set_header Host $host;
          proxy_redirect off;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_pass http://web_app;
      }

      location ~ ^/js/ {
          expires 1y;
          add_header Cache-Control public;

          add_header ETag "";
          break;
      }

      location ~ ^/css/ {
          expires 1y;
          add_header Cache-Control public;

          add_header ETag "";
          break;
      }

      location ~ /\.ht {
          deny  all;
      }
  }

优缺点

  1. 使用swoole代理laravel访问速度飙升.
  2. 上传文件暂时不可用.
  3. 数据库操作未长时间测试,一般的curd没发现什么问题.
The MIT License (MIT) Copyright (c) 2015 勇者斗恶龙 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

让laravel使用swoole扩展提升性能. 展开 收起
PHP
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
PHP
1
https://gitee.com/yzdel2000/laravel_swoole.git
git@gitee.com:yzdel2000/laravel_swoole.git
yzdel2000
laravel_swoole
laravel_swoole
master

搜索帮助