一直使用的webman的1.0.10版本 看到1.2.0后發(fā)布了挺多插件的 今天想嘗下?
按文檔命令搞一下
composer require workerman/webman-framework ^1.3.0 && composer require webman/console ^1.0.16 && ./webman install
看到webman-framerwork 和 webmanc/console執(zhí)行是ok的 最后一句 install出了問(wèn)題
35 packages you are using are looking for funding.
Use the composer fund
command to find out more!
-bash: ./webman: No such file or directory
我把webman再次啟動(dòng)也沒(méi)報(bào)錯(cuò),就是這個(gè)./webman install執(zhí)行報(bào)錯(cuò) 我懷疑我這次升級(jí)沒(méi)成功?
目前已經(jīng)查了原來(lái)版本是
workerman/webman-framework v1.0.10 High performance HTTP Service Framework
升級(jí)后是
workerman/webman-framework v1.3.6 High performance HTTP Service Framework.
說(shuō)實(shí)在的 我有點(diǎn)擔(dān)心 因?yàn)槲胰ツ臧惭bwebman的時(shí)候看文檔這個(gè)目錄結(jié)構(gòu) 和現(xiàn)在文檔寫(xiě)的的目錄結(jié)構(gòu)區(qū)別還是有的 ,這個(gè)升級(jí)命令 看著有點(diǎn)擔(dān)心
將 vendor/webman/console/src/webman 拷貝到 項(xiàng)目根目錄下,然后執(zhí)行 ./webman install
執(zhí)行后報(bào)錯(cuò)了
PHP Warning: require_once(xxxxx/webman/support/bootstrap.php): failed to open stream: No such file or directory
我是很早之前的webman現(xiàn)在結(jié)構(gòu)估計(jì)有變化了 我記得全段時(shí)間有個(gè)那個(gè)升級(jí)命令 說(shuō)是把啥目錄搬過(guò)去吧
1.0的webman升級(jí),重新創(chuàng)建個(gè)項(xiàng)目,然后把a(bǔ)pp目錄搬過(guò)去吧。
composer require workerman/webman-framework ^1.3.0 && composer require webman/console ^1.0.16 && ./webman install
是1.2的升級(jí)命令
我的事情實(shí)在太多了,沒(méi)辦法把所有版本升級(jí)教程都寫(xiě)出來(lái)哈,歡迎分享你的升級(jí)教程,也能讓很多開(kāi)發(fā)者少走彎路。
背景:我們期初一直是用1.0.10的webman開(kāi)發(fā)程序 穩(wěn)定跑了大約8個(gè)月了 也做了很多東西在里面 ,當(dāng)時(shí)webman還沒(méi)做插件支持,例如:命令行插件 action-hook插件 redis隊(duì)列插件,thinkorm插件,thinkvalidate插件等等都沒(méi)有。
當(dāng)時(shí)的文檔介有說(shuō)明怎么去使用think-orm,以及think-template等。
文檔或者問(wèn)答沒(méi)有的只能自己去實(shí)現(xiàn),比如怎么把gatewayworker搞進(jìn)去。
也正是這些原因可能會(huì)給你升級(jí)到3.0帶來(lái)一些麻煩,建議先看看https://github.com/walkor/webman/releases。
來(lái)經(jīng)過(guò)實(shí)踐從1.0.10 升級(jí)到1.3.6
1 按照最新版的https://workerman.net/doc/webman/install.htm來(lái)安裝一個(gè)新的webman,我安裝的是1.3.6的webman
2 把新的webman下的app刪除,把1.0的app目錄搬過(guò)去。
a 如果你app內(nèi)的部分文件使用了use support\bootstrap\xxx 你得改成support\xxx,比如想用redis,你可能就use support\Redis了,你得改成user support\Redis;
b 如果有use support\bootstrap\Container得刪了或者注釋,比如中間件目錄app\middleware]\內(nèi)的文件,按當(dāng)時(shí)的文檔搞的中間件 很可能就用了use support\bootstrap\Container
我就發(fā)現(xiàn)這些,不確定還有其他的沒(méi)有
3 把config/下的部分文件搬過(guò)去, 我這邊是把3.0下webman/config/目錄下沒(méi)有的文件直接復(fù)制過(guò)去了,其他文件3.0的config/下的文件要改改,一般是那些你在1.0里配置過(guò)的文件,你直接改改文件里的配置項(xiàng)。比如:bootstrap.php , database.php,middleware.php,process.php,redis.php, session.php,route.php, view.php等
著重要強(qiáng)調(diào)的是4個(gè)文件 bootstrap.php, process.php ,middleware.php ,route.php,你得自己花點(diǎn)時(shí)間琢磨下
4 composer 安裝下那些你用到的包
5 一些特殊插件
一個(gè)action-hook ,一個(gè) redis隊(duì)列,一個(gè)是think-orm插件
如果你用到了beforeAction 和 afterAction 必須安裝action-hook插件 composer require webman/action-hook
如果你用到了以前的redis隊(duì)列必須安裝redis隊(duì)列,composer require webman/redis-queue,如果你process.php內(nèi)自定義了redis_consumer,想繼續(xù)用,你就把config/plugin/webman/redis-queue/app.php里的enable改成false,或者刪了process.php的redis_consumer,配置下config/plugin/webman/redis-queue/process.php
如果你用到了think-orm你必須安裝composer require webman/think-orm,配置文件還是config目錄下里的thinkorm.php
我這樣就差不多了,你們的情況不一樣的話 可能會(huì)還有一些東西要搞搞,反正你就php star.php start 去調(diào)試 看看報(bào)錯(cuò)在哪里去找