WHMCS安装流程
whmcs安装环境:(https://docs.whmcs.com/System_Environment_Guide)
1. PHP Version 5.6.0 or later 2. MySQL Version 5.2.0 or later 3. Curl Support (with SSL) 4. GD2 Image Library 5. PHP JSON support 6. PHP PDO (PDO & MySQL PDO) 7. PHP Memory Limit 64MB (minimum) 8. MySQL Strict Mode disabled 9. Ioncube Loader 10.1.0 or later
总的安装脚本
yum -y install epel-release
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum -y update
yum -y remove firewalld
yum -y install iptables-services vim gcc make lrzsz
sed -i "s/SELINUX=enforcing/SELINUX=permissive/g" /etc/selinux/config
setenforce 0
yum -y install httpd php72w php72w-cli php72w-mysqlnd php72w-gd
yum -y install mariadb
yum -y install mairadb-server
##install ioncube
cd /tmp/
if [ ! -f /tmp/ioncube_loaders_lin_x86-64.tar.gz ];then
wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
tar zxvf ioncube_loaders_lin_x86-64.tar.gz
fi
\cp -f /tmp/ioncube/ioncube_loader_lin_7.2*.so /usr/lib64/php/modules/
\cp -f /tmp/ioncube/loader-wizard.php /var/www/html/loader.php
cat >/var/www/html/info.php<<EOF
<?php
phpinfo();
?>
EOF
cat> /etc/php.d/ioncube.ini <<EOF
zend_extension = /usr/lib64/php/modules/ioncube_loader_lin_7.2.so
EOF
cat >/etc/httpd/conf/httpd.conf<<EOF
ServerRoot "/etc/httpd"
Listen 80
Include conf.modules.d/*.conf
User apache
Group apache
ServerAdmin root@localhost
<Directory />
AllowOverride none
Require all denied
</Directory>
DocumentRoot "/var/www/html"
<Directory "/var/www">
AllowOverride None
Require all granted
</Directory>
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
<IfModule dir_module>
DirectoryIndex index.html
</IfModule>
<Files ".ht*">
Require all denied
</Files>
ErrorLog "logs/error_log"
LogLevel warn
<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
<IfModule logio_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio
</IfModule>
CustomLog "logs/access_log" combined
</IfModule>
<IfModule alias_module>
ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
</IfModule>
<Directory "/var/www/cgi-bin">
AllowOverride None
Options None
Require all granted
</Directory>
<IfModule mime_module>
TypesConfig /etc/mime.types
AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
</IfModule>
AddDefaultCharset UTF-8
<IfModule mime_magic_module>
MIMEMagicFile conf/magic
</IfModule>
EnableSendfile on
IncludeOptional conf.d/*.conf
EOF
cat >/etc/mysql/conf.d/disable_strict_mode.cnf<<EOF
[mysqld]
sql_mode=IGNORE_SPACE,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
EOF
systemctl enable httpd systemctl enable mariadb systemctl restart httpd systemctl restart mariadb grep mod_rewrite.so /etc/httpd/conf.modules.d/00-base.conf&&echo "mod_rewrite.so ok"||echo "LoadModule rewrite_module modules/mod_rewrite.so">>/etc/httpd/conf.modules.d/00-base.conf
1 安装centos7
2 安装
MYSQL本身自带的maridb(5.5)能满足需要 yum -y install mariadb*
create database whmcs default charset utf8; //创建数据库 set password for 'root'@'localhost'=password('kkkkkk'); //修改密码
Strict Mode功能说明
不支持对not null字段插入null值
不支持对自增长字段插入”值
不支持text字段有默认值
关闭:
To disable strict SQL mode, SSH in to your server as root and create this file:
/etc/mysql/conf.d/disable_strict_mode.cnf
1
Open the file and enter these two lines:
[mysqld]
sql_mode=IGNORE_SPACE,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
php centos7自带为php5.4,需要手工安装(
PHP高版本,使用webtatic源来安装 rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
webtatic包括高版本的php55w php56w php70w php71w php72w
我们选择安装php72w
yum -y install php72w*
systemctl enable php-fpm
systemtctl start php-fpm
)
ioncube https://www.ioncube.com/loaders.php从官方下载最新版就可以了
https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
文件解压后,复制7.2的两个so文件到/usr/lib64/php/modules中
复制loader-wizard.php 到/var/www/html
cat /etc/php.d/ioncube.ini zend_extension = /usr/lib64/php/modules/ioncube_loader_lin_7.2.so
安装nginx(发现nginx url处理复杂,安装后登录时,URL处理有问题,没有走完,还是用httpd)
https://hostup.org/blog/whmcs-friendly-urls-configuration-for-nginx/
yum -y install nginx*
在/etc/nginx/nginx.conf中增加支持php模块
server { listen 80; listen [::]:80; server_name _; ## root /usr/share/nginx/html; root /var/www/html; # Load configuration files for the default server block. include /etc/nginx/default.d/*.conf; error_page 404 /404.html; location = /404.html { } error_page 500 502 503 504 /50x.html; location = /50x.html { } location ~ \.php?.*$ { root /var/www/html; fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
-------------------------------------------------
使用lamp
yum -y install httpd httpd-*
yum -y install php72w php72w-*
对httpd进行支持php72的支持
在/etc/httpd/conf/httpd.conf 末尾增加(libphp7.so可以从系统中搜索,放到/etc/httpd/modules中,如果没有可以官方网站下载源码,编译使用 ./configure --with-apxs2=/usr/bin/apxs 生成)
LoadModule php7_module modules/libphp7.so <FilesMatch \.php$> SetHandler application/x-httpd-php </FilesMatch> PHPIniDir /etc/php.ini
系统安装自带的libphp7.so不能用,需要自己编译,在www.php.net找到7.2版本下载编译
编译参数
./configure --with-apxs2=/usr/bin/apxs \
--enable-mbstring \
--enable-zip \
--enable-bcmath \
--enable-pcntl \
--enable-ftp \
--enable-exif \
--enable-calendar \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-curl \
--with-mcrypt \
--with-iconv \
--with-gmp \
--with-pspell \
--with-gd \
--with-openssl \
--with-pdo-mysql
https://www.php.net/distributions/php-7.2.34.tar.gz
在/etc/php.ini中增加
zend_extension = /usr/lib64/php/modules/ioncube_loader_lin_7.2.so
打开http://ip/loader-wizard.php 测试ioncube是否加载成功

上传whmcs安装包到/var/www/html 然后打开http://ip/admin进程安装就可以了
配置http的rewrite及允许.htaccess (https://devops.ionos.com/tutorials/install-and-configure-mod_rewrite-for-apache-on-centos-7/)
文件/etc/httpd/conf.modules.d/00-base.conf
添加:
LoadModule rewrite_module modules/mod_rewrite.so
文件 /etc/httpd/conf/httpd.conf
将AllowOverride None 改为All
<Directory /var/www/html>
AllowOverride All
</Directory>

浙公网安备 33010602011771号