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
1 安装centos7
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 mairadb-server
systemctl enable httpd
systemctl enable mariadb
systemctl start httpd
systemctl start mariadb
2 安装
MYSQL本身自带的maridb(5.5)能满足需要 yum -y install mariadb*
create database whmcs default charset utf8; //创建数据库 set password for 'root'@'localhost'=password('kkkkkk'); //修改密码
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>