fis-plus icon indicating copy to clipboard operation
fis-plus copied to clipboard

使用 PHP 内建 Server 模拟运行 fis-plus 项目

Open oxUnd opened this issue 10 years ago • 7 comments

大家都知道为了模拟运行 fis-plus 项目,不得不去渲染 smarty 模板,那么就不得不有个服务能支持 php 的渲染;

所以有了 fisp server,它是一个用 jetty 启动 php-cgi 的一个服务,jetty 需要 java 支持而 php-cgi 当然是必须当然需要的了;

有的同学可能苦于怎么安装上 java 和 php-cgi,安装上了可能也一堆的问题;

这块给大家分享一个使用 php 内建 Server 运行 fis-plus 项目的方法,这样你就不需要去使用 fisp 自带的 Server 了;

自从 php 5.4 开始,php 内就内建了一个 Server,具体参考 http://php.net/manual/zh/features.commandline.webserver.php 这个链接;

本地模拟运行 fis-plus 的项目只需要一下几个步骤:

fisp release -d ../output #如果有俩模块都发布到一个目录下,比如 ../output
# 请不要为以下这行命令纠结,因为本身对你没啥成本;
fisp server install server-env --root ../output
cd ../output
php -S 127.0.0.1:8080 index.php

通过这个操作你就可以轻松跑起来 fis-plus 的项目

注意,仅限本地模拟调试

oxUnd avatar Jun 03 '15 04:06 oxUnd

:+1: 这个server 能渲染 smarty?

leecade avatar Jun 03 '15 04:06 leecade

@leecade 渲染 Smarty 不是服务干的,是写的程序干的,就是里面这句下载的代码;

fisp server install server-env --root ../output

oxUnd avatar Jun 03 '15 04:06 oxUnd

apache 能不能跑起fis-plus项目呢~~请问~~ 怎么部署

yangbys avatar Jun 06 '15 14:06 yangbys

@yangbys http://www.orrafy.com/posts/fisbook/fis-plus-online/

你需要对 PHP 比较了解,以及对服务器比较了解;

oxUnd avatar Jun 06 '15 23:06 oxUnd

你再看看,我想你能搞明白。

在 2015年6月7日,上午9:26,yangbys [email protected] 写道:

@xiangshouding 我意思是现在不需要后端那边帮忙把本地能跑起来的fis-plus 项目完完全全的搬到服务器上运行,意思就是本地是什么数据,我上传文件服务器也能跑走来,跟本地一样的运行...只是到面fis-plus是用jetty 服务的,但我服务器是用apache服务的~~~这个怎么设置部署跑起来呢....

— Reply to this email directly or view it on GitHub.

oxUnd avatar Jun 07 '15 01:06 oxUnd

你再看看,我明白你想要什么。并且把相关内建 server 也运行一遍,并且把 index.php 也看看,然后感受一下。

在 2015年6月7日,上午11:42,yangbys [email protected] 写道:

@xiangshouding 现在的问题是我不是跟后端联调的关系。而是我上传了fis-plus项目到服务器上,怎么把他运行起来~~以后我每次在本地release -d test 到我服务器的话,就可以直接显示出来本地的东西了

— Reply to this email directly or view it on GitHub.

oxUnd avatar Jun 07 '15 03:06 oxUnd

你先搞明白后端怎么运行的吧,本地调试这块也是模仿后端运行情况写的。

算了,直接告诉你吧。

本地是能跑了吧,把 fisp server open 目录下的所有文件 copy 到你 apache document_root 目录下,然后写 rewrite 把请求全都转到 index.php 即可。

不过,我感觉那些实现足够简单啊,为啥没人看看…

在 2015年6月7日,上午11:54,yangbys [email protected] 写道:

@xiangshouding http://www.orrafy.com/posts/fisbook/fis-plus-online/ 你这篇文章只是讲了前端跟后端的联调的,不是我要的结果,我要的是不需要后端,release -d test 后的项目能在自己的服务器上运行,现在fisp用的是jetty 服务,而我的服务器是 apache 的,需要怎么样去修改呢,是不是要修改apache 的 rewrite功能呢,请鼎爷指点....

— Reply to this email directly or view it on GitHub.

oxUnd avatar Jun 07 '15 03:06 oxUnd