Debian 12 安装 Live Helper Chat 4.97v 指南
在 Debian 12 上从零安装 Live Helper Chat 4.97v 的完整实测指南:Nginx+PHP8.2+MariaDB 环境搭建、发行包部署、Web 安装向导、坐席账号创建与前后台聊天端到端验证
Debian 12 安装 Live Helper Chat 4.97v 指南
目标:在一台 Debian 12 服务器上从零安装 Live Helper Chat 4.97v,完成 Nginx + PHP 8.2 + MariaDB 基础环境搭建、发行包部署、Web 安装向导、初始管理员与坐席账号创建,并以前台聊天发起、后台坐席接管回复完成端到端验证。示例账号统一为
admin/q1w2e3r4。本文所有命令与回显均来自真实安装实测(Debian 12.15,2026-10-26)。
一、环境信息
| 项目 | 本次实测值 |
|---|---|
| 操作系统 | Debian 12.15 (bookworm) |
| Live Helper Chat | 4.97v(GitHub Releases,2026-10-23 发布) |
| Web 服务器 | nginx/1.22.1 |
| PHP | 8.2.35(Debian 12 官方源自带,满足官方 8.2+ 要求) |
| 数据库 | MariaDB 10.11.19(官方要求 MySQL 5.7 / MariaDB 10.2.3+) |
| 应用根目录 | /var/www/livehelperchat/lhc_web |
| 访问方式 | http://<服务器地址>/(80 端口) |
版本与发行包信息可通过官方 Release 页确认,4.97v-with-dependencies.tgz 为含全部依赖的发行包(65.6 MB)。
二、前置条件
Live Helper Chat 4.97v 对环境的要求:
- PHP 8.2 及以上,必需扩展:
json、gd、xml、pdo、zip、mysqlnd、mbstring、bcmath,另建议curl、ldap、intl; - MySQL 5.7+ 或 MariaDB 10.2.3+;
- Nginx 或 Apache 作为 HTTP 服务器。
Debian 12 (bookworm) 官方仓库自带 PHP 8.2,无需第三方源,本篇全部软件均来自系统官方源。
三、安装 Nginx、MariaDB 与 PHP
3.1 安装软件包
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y \
nginx mariadb-server \
php8.2-fpm php8.2-mysql php8.2-gd php8.2-xml php8.2-zip \
php8.2-mbstring php8.2-bcmath php8.2-curl php8.2-ldap php8.2-intl \
unzip curl
安装完成后确认版本:
php -v | head -1
PHP 8.2.35 (cli) (built: Oct 21 2026 06:29:51) (NTS)
mariadb --version
mariadb Ver 15.1 Distrib 10.11.19-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper
nginx -v
nginx version: nginx/1.22.1
确认必需扩展已就位:
php -m | grep -iE 'gd|mbstring|pdo_mysql|curl|zip|bcmath|ldap|intl'
bcmath
curl
gd
intl
ldap
mbstring
pdo_mysql
zip
3.2 启动服务
systemctl start nginx mariadb php8.2-fpm
systemctl is-active nginx mariadb php8.2-fpm
active
active
active
建议同时设置开机自启:systemctl enable nginx mariadb php8.2-fpm。
四、创建数据库与专用账号
登录 MariaDB,创建 lhc 数据库与专用用户(口令替换为自己的强口令,本文以 q1w2e3r4 演示):
mariadb
CREATE DATABASE IF NOT EXISTS lhc CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER IF NOT EXISTS 'lhcuser'@'localhost' IDENTIFIED BY 'q1w2e3r4';
GRANT ALL PRIVILEGES ON lhc.* TO 'lhcuser'@'localhost';
FLUSH PRIVILEGES;
SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| lhc |
| mysql |
| performance_schema |
| sys |
+--------------------+
五、下载并部署发行包
5.1 下载
从 GitHub Releases 下载 4.97v 含依赖发行包:
cd /tmp
curl -L -o lhc-dist.tgz \
'https://github.com/LiveHelperChat/livehelperchat/releases/download/4.97v/4.97v-with-dependencies.tgz'
ls -lh lhc-dist.tgz
-rw-r--r-- 1 root root 66M Oct 26 07:16 lhc-dist.tgz
注意 URL 路径中 tag 为 4.97v(不带 v 前缀),写成 download/v4.97v/... 会得到 9 字节的 Not Found 文本文件——这是本次实测踩到的第一个坑,下载后务必核对文件大小。
5.2 解压与部署
mkdir -p /tmp/lhc-dist && tar -xzf lhc-dist.tgz -C /tmp/lhc-dist
ls /tmp/lhc-dist/
livehelperchat-master
mv /tmp/lhc-dist/livehelperchat-master /var/www/livehelperchat
ls /var/www/livehelperchat/lhc_web/
cache cli composer.json composer.lock cron.php deploy.sh design doc
extension ezcomponents gulpfile.js index.php lib modules package-lock.json
package.json pos settings translations var webpack.config.js
Web 入口目录为 lhc_web/(含 index.php 与 cron.php)。
5.3 设置目录权限(按官方安装文档)
将 Web 入口下三个目录属主改为 HTTP 运行用户 www-data,并按官方清单对各存储子目录授予 755:
cd /var/www/livehelperchat/lhc_web
chown www-data:www-data -R cache/ var/ settings/
chmod -R 755 cache/
chmod 755 settings/
for d in storage userphoto storageform storageadmintheme botphoto bottrphoto \
storageinvitation storagedocshare storagetheme tmpfiles; do
chmod -R 755 var/$d
done
ls -ld cache var settings
drwxr-xr-x www-data cache
drwxr-xr-x www-data settings
drwxr-xr-x www-data var
六、配置 Nginx 站点
Live Helper Chat 的 URL 形如 /index.php/site_admin/...,依赖 PHP pathinfo,Nginx 配置需按 fastcgi_split_path_info 方式传递 PATH_INFO:
cat > /etc/nginx/sites-available/lhc <<'EOF'
server {
listen 80 default_server;
server_name _;
root /var/www/livehelperchat/lhc_web;
index index.php;
client_max_body_size 32M;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/run/php/php8.2-fpm.sock;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff2?)$ {
expires 7d;
access_log off;
}
}
EOF
启用站点并重载:
rm -f /etc/nginx/sites-enabled/default
ln -sf /etc/nginx/sites-available/lhc /etc/nginx/sites-enabled/lhc
nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
systemctl reload nginx
七、Web 安装向导
浏览器访问安装入口:
http://<服务器地址>/index.php/site_admin/install/install
7.1 第一步:环境检查
安装器自动检查目录写权限与 PHP 扩展。按第五节设置权限后,全部检查项应为 Yes(以下为实测页面完整回显,节选):
Checking folders permission
I can write to "cache/cacheconfig" directory Yes
I can write to "cache/translations" directory Yes
I can write to "cache/userinfo" directory Yes
I can write to "cache/compiledtemplates" directory Yes
I can write to "settings/" directory Yes
I can write to "var/storage" directory Yes
I can write to "var/userphoto" directory Yes
I can write to "var/storageform" directory Yes
I can write to "var/storageadmintheme" directory Yes
I can write to "var/botphoto" directory Yes
I can write to "var/bottrphoto" directory Yes
I can write to "var/storageinvitation" directory Yes
I can write to "var/storagedocshare" directory Yes
I can write to "var/storagetheme" directory Yes
I can write to "var/tmpfiles" directory Yes
Is the php_curl extension installed Yes
Is the mbstring extension installed Yes
Is the php-pdo extension installed Yes
Is the gd extension installed Yes
Is the json extension detected Yes
Is the bcmath extension detected Yes
Is the php-xml extension detected Yes
Minimum 5.4 PHP Yes
点击 Next 进入第二步。
7.2 第二步:数据库设置
表单字段依次填入第四节创建的数据库信息:
| 字段 | 值 |
|---|---|
| Database Username | lhcuser |
| Database Password | q1w2e3r4 |
| Database Host | 127.0.0.1 |
| Database Port | 3306 |
| Database Name | lhc |
提交后安装器连接数据库并完成建表,随后进入第三步。
7.3 第三步:初始管理员
| 字段 | 值 |
|---|---|
| Admin username | admin |
| Admin password / repeat | q1w2e3r4 |
| admin@example.com | |
| Your name | Admin |
| Your surname | User |
| Default department | Support |
点击 Finish installation,实测返回:
Installation was completed
Installation is complete. You can start by adding users and departments.
八、安装后验证
8.1 登录后台
访问后台登录页:
http://<服务器地址>/index.php/site_admin/user/login
用 admin / q1w2e3r4 登录,成功后进入管理仪表盘(实测页面头部显示 Hello Admin!),左侧菜单含 Dashboard、Chats and Mails、Online visitors、Settings 等模块。
8.2 创建坐席(operator)账号
坐席账号用于一线接待,管理员账号仅做后台管理。进入后台 System configuration → Users → New user(URL 为 /index.php/site_admin/user/new),填写:
| 字段 | 值 |
|---|---|
| Username | operator1 |
| Password / repeat | q1w2e3r4 |
| operator1@example.com | |
| Chat nickname | Agent01 |
| Name / Surname | Operator One |
| Job title | Support Agent |
| User time zone | Application default time zone |
| Assigned departments | All departments |
保存后跳回用户列表,数据库中可见新账号(可在服务器上用 mariadb lhc 核对):
SELECT id,username,name,surname,email FROM lh_users ORDER BY id;
id username name surname email
1 admin Admin User admin@example.com
2 operator1 Operator One operator1@example.com
排障提示:新建用户页面(
user/new)的提交处理只识别Update_account按钮;如果从「编辑用户」页(user/edit)拿表单结构直接 POST 到user/new,请求会被静默忽略并重新渲染表单(HTTP 200 但不落库)。以 New user 页面自身提交为准。
8.3 让坐席保持在线
全新安装后坐席默认离线,前台访客会看到 "Chat is currently unavailable"。在后台把账号设为长期在线(在线状态开关),或登录坐席端手动置为在线。置为在线后,前台聊天窗即可正常发起会话。
九、前台聊天与后台接待端到端验证
9.1 获取访客聊天入口
Live Helper Chat 提供多种前台接入方式,直接可测的访客聊天窗地址为:
http://<服务器地址>/index.php/chat/chatwidget
正式站点推荐用后台 Chat → Get status embed(/index.php/site_admin/chat/getstatusembed)生成的嵌入脚本,将其插入业务网页即可悬浮显示聊天窗。该接口无需登录即可访问(HTTP 200),返回一段自包含 JS,内部通过 iframe 加载 chat/chatwidget。
9.2 访客发起聊天
打开聊天窗后显示提问表单(实测页面文本 Have a question? Ask us! / Your question*),输入问题提交后聊天进入等待队列。数据库验证(示例中部门 id=1):
SELECT id,dep_id,nick,status FROM lh_chat;
SELECT id,chat_id,user_id,LEFT(msg,60) FROM lh_msg WHERE chat_id=1;
id dep_id nick status
1 1 Visitor 0 -- 0 = 排队中 (pending)
id chat_id user_id LEFT(msg,60)
1 1 0 Hello, I need help with my order.
9.3 坐席接管并回复
坐席登录后台,在 Chats and Mails → Chat tabs → Chats List 打开该 pending 聊天的会话窗(/index.php/site_admin/chat/single/1),发送回复。实测数据库回显:
id chat_id user_id LEFT(msg,60)
1 1 0 Hello, I need help with my order.
2 1 1 Hello! This is support. How can I help you?
3 1 -1 Admin User has accepted the pending chat by sending a message
id nick status user_id
1 Visitor 1 1 -- 1 = 进行中,user_id=1 即接管坐席
- 访客消息
user_id=0,坐席回复user_id=1,user_id=-1为系统事件消息("某坐席已通过发送消息接管了排队聊天"); - 聊天状态从
0(排队)变为1(进行中),且lh_chat.user_id记录接管坐席。
至此从安装、账号创建到前后台对话的完整链路验证通过。
十、常见问题排障
以下均为本次实测真实发生并已解决的问题。
10.1 下载发行包得到 9 字节文件
Release 附件 URL 的 tag 部分是 4.97v 而非 v4.97v:
# 错误(返回 9 字节的 "Not Found")
https://github.com/LiveHelperChat/livehelperchat/releases/download/v4.97v/4.97v-with-dependencies.tgz
# 正确
https://github.com/LiveHelperChat/livehelperchat/releases/download/4.97v/4.97v-with-dependencies.tgz
下载后用 ls -lh 确认约为 66M。
10.2 前台显示 "Chat is currently unavailable"
原因是没有任何坐席在线(或所属部门无在线坐席)。按 8.3 节把坐席置为长期在线即可。该行为由部门在线状态决定,与安装是否成功无关。
10.3 访客提交聊天报 "Security token is missing"
Live Helper Chat 对发起聊天表单做了时间戳令牌校验(默认 session_captcha 关闭时,表单必须携带 tscaptcha 与按 sha256(指纹 + tscaptcha + secrethash) 命名的字段,取值为近 30 分钟内的时间戳)。浏览器正常访问由前端 JS 自动完成;若用脚本直连测试,必须先 GET 表单页获取页面内随机参数,再按页面 JS 的算法补齐字段,否则一律返回:
Your request was not processed as expected - but don't worry it was not your fault.
Please re-submit your request. If you experience the same issue you will need to
contact us via other means. Security token is missing. IP - 127.0.0.1
10.4 后台 AJAX 接口报 "We could not verify your request"
管理端的 AJAX 接口(如发送消息 chat/addmsgadmin/<chat_id>)不读表单字段,而是校验 HTTP 请求头 X-CSRFToken;且令牌与登录会话绑定。直接把页面隐藏域里的旧 token 以表单参数提交会得到:
{"error":"true","r":"Try again or refresh a page. We could not verify your request."}
正确做法是随当前登录会话取最新 token 放入请求头。
10.5 新建用户 POST 返回 200 但不落库
见 8.2 节排障提示:user/new 只处理 Update_account 按钮的提交,user/edit(编辑态)表单的提交按钮名为 Save_account,两者不通用。
10.6 出现 "Site Maintenance" 页面
Live Helper Chat 捕获未处理异常时返回 HTTP 503 与维护页,真实错误栈记录在 Nginx 错误日志(/var/log/nginx/error.log,FastCGI stderr 消息)中。本次实测触发过一次:对无参数的 user/edit 直接 POST,模板将空用户对象误当已存在对象处理导致 Call to a member function getState() on bool。从 user/new 页面走标准创建流程即可避免。
十一、参考链接
- Live Helper Chat 官方安装文档:https://docs.livehelperchat.com/docs/installing/
- GitHub Releases(4.97v 发行包):https://github.com/LiveHelperChat/livehelperchat/releases/tag/4.97v
- 安装入口与后台路径速查:
index.php/site_admin/install/install(安装)、index.php/site_admin/user/login(登录) - 同类系统在站内的对比见《Live Helper Chat 4.97v 介绍与选型指南》。