安装
环境要求:PHP >= 5.6

1.安装宝塔

#Centos系统
yum install -y wget && wget -O install.sh http://download.bt.cn/install/install.sh && sh install.sh
#Ubuntu系统
wget -O install.sh http://download.bt.cn/install/install-ubuntu.sh && sudo bash install.sh
#Debian系统
wget -O install.sh http://download.bt.cn/install/install-ubuntu.sh && bash install.sh
安装完成后,进入面板,点击左侧软件管理,然后安装PHP、Mysql、Nginx、phpmyadmin。

2.拉取源码

点击左侧网站,添加站点,使用命令:

cd www/wwwroot/xx.com
git clone https://gitee.com/nickbai/whisper_tp5.git
#如果移动的时候有mv提示,直接Enter即可 mv whisper_tp5/{,.}* ./
chmod 775 ./ ./runtime/temp/
3.网站设置

进入到域名设置,点击网站目录,去除跨站攻击的√,并设置运行目录为public。
然后点击伪静态设置,填入以下代码:

location / { if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last; break;
}
}
4.新建数据库

点击面板左侧数据库,点击phpmyadmin进入数据库管理界面,新建whisper数据库。
再将根目录的whisper.sql文件导入到数据库,然后修改根目录application/database.php配置信息。
修改如下

// 服务器地址
‘hostname’ => ‘127.0.0.1’,
// 数据库名
‘database’ => ‘whisper’,
// 用户名
‘username’ => ‘root’,
// 密码
‘password’ => ‘root’,
// 端口
‘hostport’ => ‘3306’,
5.安装拓展

环境一般只要安装两个扩展即可,一个是pcntl,一个是libevent(event)。 pcntl为必须的,libevent为非必须的,但是起到高性能作用的恰恰是libevent(event)。 如果你您的并发并不是很高,咨询量也不是很大,您可以不安装这个扩展,Gatewayworker会采用系统的select同样性能可观。
6.查看已安装的PHP拓展:

php -m
这时候发现必需的pcntl拓展已被安装,接下来就安装另外一个拓展了(一般情况下可以不用安装),即PHP5.x安装libevent扩展,PHP7.x安装event拓展。
PHP7.x安装event拓展,博主以PHP7.0测试环境,如果你是7.1将下面目录70改成71即可:

#event包下载地址http://pecl.php.net/package/event,这里以最新版2.4.1为准
cd /www/server/php
wget http://pecl.php.net/get/event-2.4.1.tgz tar -zxvf event-2.4.1.tgz && cd event-2.4.1 /www/server/php/70/bin/phpize
./configure –with-php-config=/www/server/php/70/bin/php-config –with-event-libevent-dir=/www/server/php/event-2.4.1/
make && make install
echo “extension=event.so” >> /www/server/php/70/etc/php.ini
PHP5.x安装libevent扩展,这里以PHP5.6测试环境,使用命令:

cd /www/server/php
wget https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz
tar -zxvf libevent-2.1.8-stable.tar.gz && cd libevent-2.1.8-stable
/www/server/php/56/bin/phpize
./configure –with-php-config=/usr/local/php/bin/php-config –with-libevent=/www/server/php/libevent-2.1.8-stable/ make && make install
echo “extension=libevent.so” >> /www/server/php/56/etc/php.ini
7.启动程序

这时候需要先下载服务端文件,下载地址:whisper_server.zip,然后解压上传到网站根目录vendor目录里,再编辑以下文件。
编辑vendor/GatewayWorker/Applications/whisper/Events.php文件

#修改数据库名和密码
self::$db = new WorkermanMySQLConnection(‘127.0.0.1’, ‘3306’, ‘root’, ‘pass’, ‘whisper’);
然后启动程序:
进入服务端文件夹

cd /www/wwwroot/xx.com/vendor/GatewayWorker
后台运行PHP

php start.php start -d
然后再到宝塔的安全里开启8282端口。

然后再配置application/config.php,进行如下修改:

‘socket’ => ‘192.168.1.104:8282’,
ip填写你服务器的ip。

搭建成功后程序系统为xx.com,后台后xx.com/admin,管理员用户名密码均为admin,客服的工作台xx.com/service。
接下来我们进入程序系统首页,点击右下角的客服按钮,如果出现以下提示,则为安装成功,不然请检查你的步骤。
20210608083855-1623112735428-whisper(1).png

来自https://blog.qcnhy.cn/