Hello World

吞风吻雨葬落日 欺山赶海踏雪径

0%

debian11 安装 WoWSimpleRegistration

debian11 安装 azerothcore 的对应注册网站 WoWSimpleRegistration

WoWSimpleRegistration

WoWSimpleRegistration 是PHP项目
支持 AzerothCore, TrinityCore, AshamaneCore, CMangos.

需要php >= 7.0 且依赖模块 gmp, gd, soap, mbstring, pdo and pdo-mysql.

Windows的安装

首先在本地安装测试,本地环境是Windows 10。因为对PHP并不是很了解,这里直接选择了集成环境php-study

按照说明理论上只需要安装 php / apache or nginx / mysql 就可以了。

php-study 安装好后首先是模块的启用,然后重启 Apache 。模块的启用修改 php.ini,比如

1
;extension=soap

改成

1
extension=soap

全量配置

1
2
3
4
5
extension=gmp
extension=gd2
extension=soap
extension=mbstring
extension=php_pdo_mysql.dll

把上面下载的源码 \application\config 里面的 config.php.sample 复制一份到 config.php 修改参数。

WoWSimpleRegistration目录作为网站根目录,启动Apache

问题记录

访问显示403

修改 application 下的 .htaccess 文件:

Require all denied 改为 Require all granted

Deny from all 改为 Allow from all

The server requested authentication method unknown to the client

mysql 8.0 之后的默认认证方式变动了。 PHP with MySQL 8.0+ error: The server requested authentication method unknown to the client

要修改默认的认证方式需要修改

1
2
[mysqld]
default_authentication_plugin=mysql_native_password

但是创建用户的时候已经确定了用户的认证方式,可以查看 mysql.user 表的 plugin字段。

修改

1
2
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password
BY 'password';

我这里直接创建一个新帐号

1
2
3
4
5
6
CREATE USER 'gm'@'%' IDENTIFIED  WITH mysql_native_password BY 'gm' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0;
GRANT ALL PRIVILEGES ON `acore_world`. * TO 'gm'@'%' ;
GRANT ALL PRIVILEGES ON `acore_characters`. * TO 'gm'@'%' ;
GRANT ALL PRIVILEGES ON `acore_auth`. * TO 'gm'@'%' ;

select * from mysql.user;

改下 config.php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
=====================================================================*/
$config['db_auth_host'] = '127.0.0.1';
$config['db_auth_port'] = '3306';
$config['db_auth_user'] = 'gm';
$config['db_auth_pass'] = 'gm';
$config['db_auth_dbname'] = 'acore_auth';
/*===================================================================
Your character's databases.
If your server has a lot of realms you can check the example at the bottom of the file.
=====================================================================*/
$config['realmlists'] = array(
"1" => array(
'realmid' => 1, // Realm ID
'realmname' => "AzerothCore", // Realm Name
'db_host' => "127.0.0.1", // MySQL Host IP
'db_port' => "3306", // MySQL Host Port
'db_user' => "gm", // MySQL username
'db_pass' => 'gm', // MySQL password
'db_name' => "acore_auth" // Characters database name
)
);

SMTP的配置

找回密码与修改密码功能都需要使用邮箱功能,WoWSimpleRegistration提供了SMTP功能可以发送邮件。

SMTP知识回顾

SMTP rfc5321

这里使用阿里个人邮箱 ,以前注册过一个账号作为通知邮箱的,这次正好用上。SMTP配置如下:

1
2
3
4
5
6
7
$config['smtp_host'] = 'smtp.aliyun.com';
$config['smtp_port'] = 465;
$config['smtp_auth'] = true;
$config['smtp_user'] = '账号@aliyun.com';
$config['smtp_pass'] = '密码';
$config['smtp_secure'] = 'ssl';
$config['smtp_mail'] = '账号@aliyun.com';

注意这里的加密方式使用 ssl,对应的端口是 465

之后就可以直接使用了,测试了一下功能都支持。

debian 11 的安装

debian 11 上主要还是需要安装 phpnginx 且配置好对应的关系。

首先安装PHP

1
2
sudo apt update
sudo apt install php php-cgi php-fpm php-mysql -y

在继续安装php组件(这里需要单独安装否则一直会 500 错误页面白屏。。。)

  • GMP Extension
  • GD Extension
  • Soap Extension
  • Mbstring Extension
  • PDO Extension
  • PDO-MySQL Extension
1
sudo apt install php-gmp php-curl php-mbstring  php-gd php-soap php-imap php-mysql php-pdo -y

安装nginx

1
sudo apt install nginx

修改nginx的配置文件

1
sudo vim /etc/nginx/sites-available/default

注意,这里面 root 指向/var/www/html

nginx 还需要配置 charset 支持中文

1
2
3
4
server{
...
charset 'utf-8';
}

好了,开始 nginx 配置 php

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
server {
listen 80;
listen [::]:80;
charset 'utf-8';

root /var/www/html;
index index.php index.html index.htm;

server_name your_domain;

location / {
try_files $uri $uri/ =404;
}

location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php-fpm.sock;
}
}

修改PHP配置
/etc/php/8.1/fpm/php.ini

1
2
3
extension=curl
;extension=ffi
打开上面php组件的配置

重启nginx

1
sudo systemctl restart nginx

最好安装一个 php 探针看下组件是安装成功。

好了,网站可以访问了。

参考

How To Install PHP 8.2 on Debian 12/11/10