如何在 Debian 9 下安装 LEMP 和 WHMCS 7.5
WHMCS 7.5 发布了,它开始支持 PHP 7.2,这里就写个简单的教程记录一下安装方式。
1、准备工作
首先,我们需要按照 在Debian 9 / Debian 8 下使用源安装方式安装 LEMP 一文,安装好 LEMP 环境,可以选一些需要用到的 PHP 7.2 软件包:
apt-get install php7.2-fpm php7.2-mysql php7.2-curl php7.2-gd php7.2-mbstring php7.2-xml php7.2-xmlrpc php7.2-zip php7.2-json php7.2-imap php7.2-opcache -y
2、安装 ionCube Loader 10
WHMCS 7.5 开始,已不支持老版本 ionCube Loader,所以我们需要从官网上下载最新的版本并进入解压后的 ioncube 目录
wget http://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.zip unzip ioncube_loaders_lin_x86-64.zip cd ioncube
按照默认编译 PHP 7.2 的 PHP Extension 我们可以找到 PHP 7.2 扩展的目录在 /usr/lib/php/20170718/
对应的话,PHP 7.0 在 /usr/lib/php/20151012/,PHP 7.1 在 /usr/lib/php/20160303/
然后把 ioncube 目录里的 ioncube_loader_lin_7.2.so 给复制过去
cp -r ioncube_loader_lin_7.2.so /usr/lib/php/20170718/
对应 PHP 7.1 就是
cp -r ioncube_loader_lin_7.1.so /usr/lib/php/20160303/
对应 PHP 7.0 就是
cp -r ioncube_loader_lin_7.0.so /usr/lib/php/20151012/
然后增加一个 FPM 的模块配置文件
cat >> /etc/php/7.2/mods-available/ioncube.ini << EOF zend_extension = ioncube_loader_lin_7.2.so
然后给 PHP-FPM 和 PHP-Cli 都增加 ioncube 模块
ln -s /etc/php/7.2/mods-available/ioncube.ini /etc/php/7.2/fpm/conf.d/01-ioncube.ini ln -s /etc/php/7.2/mods-available/ioncube.ini /etc/php/7.2/cli/conf.d/01-ioncube.ini
然后重启 PHP-FPM
systemctl restart php7.2-fpm
我们来检查一下是否生效
root@debian ~ # php -v PHP 7.2.3-1+0~20180306120016.19+stretch~1.gbp81bf3b (cli) (built: Mar 6 2018 12:00:19) ( NTS ) Copyright (c) 1997-2018 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v10.2.0, Copyright (c) 2002-2018, by ionCube Ltd. with Zend OPcache v7.2.3-1+0~20180306120016.19+stretch~1.gbp81bf3b, Copyright (c) 1999-2018, by Zend Technologies
看到 with the ionCube PHP Loader (enabled) 即可
PS:对应的 PHP 7.1 和 PHP 7.0 用户请自行修改目录,不再重复
3、修改 MySQL 配置
按照官方说明,WHMCS 7 开始不支持 SQL strict 模式
WHMCS requires MySQL strict mode to be turned off in order for it to function.
所以我们需要关闭 Percona Server 里默认开启的 SQL strict 模式
直接修改 /etc/mysql/percona-server.conf.d/mysqld.cnf 文件,把 sql_mode 改成 sql_mode=NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION 即可
最后这文件看上去就像这样子
[mysqld] user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr datadir = /var/lib/mysql tmpdir = /tmp lc-messages-dir = /usr/share/mysql explicit_defaults_for_timestamp # Instead of skip-networking the default is now to listen only on # localhost which is more compatible and is not less secure. bind-address = 127.0.0.1 log-error = /var/log/mysql/error.log # Recommended in standard MySQL setup sql_mode=NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0
---------------
[mysqld] user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr datadir = /var/lib/mysql tmpdir = /tmp lc-messages-dir = /usr/share/mysql explicit_defaults_for_timestamp # Instead of skip-networking the default is now to listen only on # localhost which is more compatible and is not less secure. bind-address = 127.0.0.1 log-error = /var/log/mysql/error.log # Recommended in standard MySQL setup sql_mode=NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0
重启 MySQL
systemctl restart mysql
最后配置 Nginx 和安装 WHMCS 就不再多重复了