Swoole應(yīng)用:?web項(xiàng)目,IM通信,網(wǎng)絡(luò)游戲,微服務(wù)
? ? ? ? ? ? ? ? ? ? ? swoft,easyswoole,hyperf,imi,swostar,composer組件
安裝swoole
1? 配置虛擬機(jī)?使用 CentOs7 64系統(tǒng)
2? 使用phpstudy? 安裝小皮面板
? ? 2.1?腳本
?????Centos安裝腳本:yum?install?-y?wget?&&?wget?-O?install.sh?https://download.xp.cn/install.sh?&&?sh?install.sh
Ubuntu安裝腳本 :wget?-O?install.sh?https://download.xp.cn/install.sh?&&?sudo?bash?install.sh
? 常用命令安裝完成后可以在ssh工具中使用xp?命令,來(lái)查看,面板狀態(tài),重啟,關(guān)閉,修改面板密碼,查看面板密碼等。
=============運(yùn)行狀態(tài)=========================
docker daemon running
centos_env container running
webpanel running
phpstudy running
=================安裝完成==================
請(qǐng)用瀏覽器訪問(wèn)面板:
外網(wǎng):http://122.115.237.19:9080/7AE787
內(nèi)網(wǎng):http://192.168.32.128:9080/7AE787
系統(tǒng)初始賬號(hào):admin
系統(tǒng)初始密碼:Cu8XiG45Wj
官網(wǎng):https://www.xp.cn
如果使用的是云服務(wù)器,請(qǐng)至安全組開(kāi)放9080端口
如果使用ftp,請(qǐng)開(kāi)放21以及30000-30050端口
?安裝swoole
1?網(wǎng)址下載swoole源碼
? ??https://github.com/swoole/swoole-src/releases
下載:https://github.com/swoole/swoole-src/archive/v4.5.6.tar.gz??
上傳到服務(wù)器/root/build目錄中
然后執(zhí)行下面命令
1:tar zxvf v4.5.6.tar.gz:
2:cd swoole-src/
3:phpize? ??
提示錯(cuò)誤信息:-bash: ./phpize: No such file or directory
說(shuō)明沒(méi)有phpize?命令? 執(zhí)行yum安裝phpize
4:yum install php-devel
再次執(zhí)行phpize命令
提示以下信息說(shuō)明成功
PHP Api Version: 20100412
Zend Module Api No:? ? ? 20100525
Zend Extension Api No:? 220100525
5:phpize
6:?./configure
提示錯(cuò)誤信息:See `config.log' for more details
說(shuō)明沒(méi)有安裝命令//安裝C++編譯環(huán)境
sudo yum? install gcc-c++
7?
提示錯(cuò)誤:make: *** [ext-src/php_swoole.lo] Error 1
查詢php -v?顯示PHP版本不是php7?則執(zhí)行以下步驟?更改為php7
? ?查詢php包? : yum list installed |?grepphp?
? ? 刪除php版本:yum remove php
? ?刪除php其他文件: yum remove php-*
更換 RPM?源
#Centos 5.X:
rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rpm
#CentOs 6.x:
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
#CentOs 7.X:
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
安裝?php7版本? yum?install-y php71w php71w-cli php71w-common php71w-devel php71w-embedded php71w-fpm php71w-gd php71w-mbstring php71w-mysqlnd php71w-opcache php71w-pdo php71w-xml php71w-ldap php71w-mcrypt
然后再重新執(zhí)行第五步:
phpize? &&? ./configure? &&? make && sudo make install
8?補(bǔ)充擴(kuò)展
編譯安裝到系統(tǒng)成功后,需要在?php.ini?中加入一行?extension=swoole.so?來(lái)啟用 Swoole 擴(kuò)展
方法2
安裝集成環(huán)境:?寶塔
命令:yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh
==================================================================
Congratulations! Installed successfully!
外部: http://122.115.237.19:8888/1edde0c7
本地: http://http://192.168.138.128:8080//1edde0c7
username: wangkuo? ?
password: wangkuo
添加:
1 extension=swoole.so
保存退出。
驗(yàn)證是否安裝成功
php --ri swoole
查看版本:
php --ri swoole | grep Version