下载安装编译工具

yum groupinstall 'Development Tools'

安装依赖包

yum install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel ncurses curl gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel expat-devel xmlrpc-c xmlrpc-c-devel libicu-devel libmcrypt-devel libmemcached-devel

安装CMake3

yum remove cmake
wget https://github.com/Kitware/CMake/releases/download/v3.17.5/cmake-3.17.5-Linux-x86_64.tar.gz
tar zxvf cmake-3.17.5-Linux-x86_64.tar.gz
vi /etc/profile.d/cmake.sh
export CMAKE_HOME=/root/cmake-3.17.5-Linux-x86_64
export PATH=$PATH:$CMAKE_HOME/bin
chmod +x /etc/profile.d/cmake.sh
source /etc/profile

简单介绍: CMake的好处是方便跨平台,在Linux环境下,请先创建build目录,并到目录build下,执行cmake:

mkdir build && cd build
cmake ../

安装libzip库(要求CMake版本至少3.0.0,而2.8.12.2太低), 1.3.1和1.7.0(1.7.3)都被禁止了,我换1.3.2

yum remove -y libzip
wget https://libzip.org/download/libzip-1.7.3.tar.gz
tar -zxvf libzip-1.7.3.tar.gz
cd libzip-1.7.3
mkdir build && cd build/
选项一 cmake -DCMAKE_INSTALL_PREFIX=/usr/local/libzip ..
[选这个]选项二 cmake ..
[1.3.2低版本] ./configure
make
make install
选项一 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
[选这个]选项二 export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/:/usr/lib/pkgconfig/
ldconfig

错误libxml

No package 'libxml-2.0' found
rpm -qa |grep  libxml2
libxml2-2.9.1-6.el7.4.x86_64

安装libxml2和libxml2-devel包
yum install -y libxml2
yum install -y libxml2-devel

错误sqlite3

No package 'sqlite3' found
error: Package requirements (sqlite3 > 3.7.4) were not met

yum install libsqlite3x-devel -y

错误libcurl

configure: error: Package requirements (libcurl >= 7.15.5) were not met:
No package 'libcurl' found

安装
yum install -y libcurl libcurl-devel

错误libjpeg

configure: error: Package requirements (libjpeg) were not met:
No package 'libjpeg' found

error: Package requirements (oniguruma) were not met

由于PHP 7.4.x中mbstring的正则功能需要oniguruma的支持,编译PHP的时候使用了 --enable-mbstring 参数,系统中却没有oniguruma库,

规避方式一: 不使用mbstring的正则功能,即在“--enable-mbstring”后再添加“--disable-mbregex”参数

规避方式二: 安装oniguruma库

yum install -y epel-release
yum install oniguruma-devel -y

编译PHP7.4 默认查找64位的动态链接库,
centos系统默认的动态链接库配置文件/etc/ld.so.conf里并没有将64位库文件加入搜索路径,
需要将 /usr/local/lib64 /usr/lib64 这些针对64位的库文件路径加进去。

添加搜索路径到配置文件

echo '/usr/local/lib64
/usr/local/lib
/usr/lib
/usr/lib64'>>/etc/ld.so.conf

更新配置
ldconfig -v

其他安装源

yum -y install http://mirror.centos.org/centos-7/7.7.1908/cloud/x86_64/openstack-queens/oniguruma-6.7.0-1.el7.x86_64.rpm
yum -y install http://mirror.centos.org/centos-7/7.7.1908/cloud/x86_64/openstack-queens/oniguruma-devel-6.7.0-1.el7.x86_64.rpm

编译安装oniguruma

wget https://github.com/kkos/oniguruma/releases/download/v6.9.5_rev1/onig-6.9.5-rev1.tar.gz
tar zxvf onig-6.9.5-rev1.tar.gz
cd onig-6.9.5
./configure --prefix=/usr --libdir=/lib64
make
make install

编译安装freetype, centos8开始要安装freetype2.10.x, 旧版系统可以是2.8.1

wget https://download.savannah.gnu.org/releases/freetype/freetype-2.10.2.tar.gz
tar zxvf freetype-2.10.2.tar.gz
cd freetype-2.10.2
./configure --prefix=/usr/local/freetype
make
make install
mkdir /usr/lib/pkgconfig
cp /usr/local/freetype/lib/pkgconfig/freetype2.pc /usr/lib/pkgconfig/
cat > /etc/ld.so.conf.d/freetype.conf<<EOF
/usr/local/freetype/lib
EOF
ldconfig
ln -sf /usr/local/freetype/include/freetype2/* /usr/include/


export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig/
ldconfig

心累,依然报错缺少libjpeg和libpng
yum install -y libjpeg libjpeg-devel libpng libpng-devel
ldconfig

编译安装openssl

wget https://github.com/openssl/openssl/archive/OpenSSL_1_1_1f.tar.gz
./config enable-weak-ssl-ciphers -fPIC --prefix=/usr/local/openssl1.1.1 --openssldir=/usr/local/ope        nssl1.1.1
make depend
make
make install

wget https://github.com/openssl/openssl/archive/OpenSSL_1_0_2u.tar.gz
tar zxvf OpenSSL_1_0_2u.tar.gz
cd openssl-OpenSSL_1_0_2u/
./config -fPIC --prefix=/usr/local/openssl --openssldir=/usr/local/openssl
make depend
make
make install
ldconfig

编译安装curl

wget https://github.com/curl/curl/releases/download/curl-7_72_0/curl-7.72.0.tar.gz
tar zxvf curl-7.72.0.tar.gz
cd curl-7.72.0
./configure --prefix=/usr/local/curl --enable-ares --without-nss --with-zlib --with-ssl=/usr/local/openssl
make
make install
ldconfig

安装libiconv

wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.16.tar.gz
tar zxvf libiconv-1.16.tar.gz
cd libiconv-1.16
./configure --prefix=/usr/local/libiconv --enable-static
make
make install

报错缺少icu

configure: error: Package requirements (icu-uc >= 50.1 icu-io icu-i18n) were not met:

No package 'icu-uc' found
No package 'icu-io' found
No package 'icu-i18n' found

yum install -y libicu-devel

安装PHP7.4


wget https://www.php.net/distributions/php-7.4.10.tar.gz
tar zxvf php-7.4.10.tar.gz
cd php-7.4.10
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-config-file-scan-dir=/usr/local/php/conf.d --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-iconv=/usr/local/libiconv --with-freetype=/usr/local/freetype --with-jpeg --with-png --with-zlib --enable-xml --disable-rpath --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl=/usr/local/curl --enable-mbregex --enable-mbstring --enable-intl --enable-pcntl --enable-ftp --enable-gd --with-openssl=/usr/local/openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --with-zip --without-libzip --enable-soap --with-gettext --enable-opcache --with-xsl --with-pear

make
make install

依然报错: configure: WARNING: unrecognized options: --with-png, --without-libzip

安装Zip库

http://pecl.php.net/get/zip-1.19.0.tgz
tar xvf zip-1.19.0.tgz
./configure  --with-php-config=/usr/bin/php-config

ln -sf /usr/local/php/bin/php /usr/bin/php
ln -sf /usr/local/php/bin/phpize /usr/bin/phpize
ln -sf /usr/local/php/bin/pear /usr/bin/pear
ln -sf /usr/local/php/bin/pecl /usr/bin/pecl
ln -sf /usr/local/php/sbin/php-fpm /usr/bin/php-fpm
rm -f /usr/local/php/conf.d/*

mkdir -p /usr/local/php/{etc,conf.d}
cp php.ini-production /usr/local/php/etc/php.ini

cd /root/php-7.4.10

sed -i 's/post_max_size =.*/post_max_size = 50M/g' /usr/local/php/etc/php.ini
sed -i 's/upload_max_filesize =.*/upload_max_filesize = 50M/g' /usr/local/php/etc/php.ini
sed -i 's/;date.timezone =.*/date.timezone = PRC/g' /usr/local/php/etc/php.ini
sed -i 's/short_open_tag =.*/short_open_tag = On/g' /usr/local/php/etc/php.ini
sed -i 's/;cgi.fix_pathinfo=.*/cgi.fix_pathinfo=0/g' /usr/local/php/etc/php.ini
sed -i 's/max_execution_time =.*/max_execution_time = 300/g' /usr/local/php/etc/php.ini
sed -i 's/disable_functions =.*/disable_functions = passthru,exec,system,chroot,chgrp,chown,shell_exec,proc_open,proc_get_status,popen,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,stream_socket_server/g' /usr/local/php/etc/php.ini

pear config-set php_ini /usr/local/php/etc/php.ini
pecl config-set php_ini /usr/local/php/etc/php.ini

wget --prefer-family=IPv4 --no-check-certificate -T 120 -t3 ${Download_Mirror}/web/php/composer/composer.phar -O /usr/local/bin/composer
if [ $? -eq 0 ]; then
    echo "Composer install successfully."
    chmod +x /usr/local/bin/composer
else
    echo "Composer install failed, try to from composer official website..."
    curl -sS --connect-timeout 30 -m 60 https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
    if [ $? -eq 0 ]; then
        echo "Composer install successfully."
    fi
fi
if [ "${country}" = "CN" ]; then
    composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
fi

cat >/usr/local/php/etc/php-fpm.conf<<EOF
[global]
pid = /usr/local/php/var/run/php-fpm.pid
error_log = /usr/local/php/var/log/php-fpm.log
log_level = notice

[www]
listen = /tmp/php-cgi.sock
listen.backlog = -1
listen.allowed_clients = 127.0.0.1
listen.owner = www
listen.group = www
listen.mode = 0666
user = www
group = www
pm = dynamic
pm.max_children = 10
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 6
pm.max_requests = 1024
pm.process_idle_timeout = 10s
request_terminate_timeout = 100
request_slowlog_timeout = 0
slowlog = var/log/slow.log
EOF

cp ${cur_dir}/src/${Php_Ver}/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
cp ${cur_dir}/init.d/php-fpm.service /etc/systemd/system/php-fpm.service
chmod +x /etc/init.d/php-fpm

groupadd www
useradd -s /sbin/nologin -g www www

yum -y install libxml2
yum -y install libxml2-devel
yum install sqlite-devel
yum install bzip2 bzip2-devel
yum install libxslt-devel
yum install libpng-devel

六间房直播间 聊天室, 刷屏脚本


let str = '1.绿色要正,我们都知道翡翠是以绿为贵,所以对于一块好翡翠来说,绿色的色调越纯正越好,尽可能不偏黄、不偏蓝、不偏灰,绿色越纯正,翡翠价值越高。2.绿色分布要均匀,一般来说一件翡翠作品,它的绿色分布的越均匀,价值高,比如满绿的翡翠那是翡翠中价值最高的翡翠。3.水头要足,俗话说内行看种,外行看色,一件翡翠种水好的话,就算翡翠不是绿色,它的价值也会很低,而且是水头越好,翡翠的价值越高,如果翡翠的水头达到了半透明以上,那么这块翡翠就是特级翡翠了。4.瑕疵要少,不管是任何的宝石,瑕疵越少,价值越高,翡翠越是一样的,不过由于翡翠是天然的玉石,多少都会有一定瑕疵,因此在瑕疵不影响翡翠价值的情况下,我们要学会接受翡翠的瑕疵。5.裂纹要少,裂纹那是翡翠价值的杀手,因为裂纹不仅仅影响翡翠的美观,还影响翡翠的强度。翡翠裂纹对翡翠影响是致命的,所以我们在挑选翡翠的千万要看清楚,因为裂纹轻者有断裂的隐患,严重的情况就是翡翠饰品在佩戴的时候有可能会从裂纹处断裂。';
let i = 0;
window.setInterval(function(){
let end = Math.floor(Math.random()*10+1)
Room.chatList.sendPubMsg({tuid: "",con: str.substr(i, end)});
i += end;
},3100);

对于sendPubMsg 方法, 进一步跟踪, 得到以下代码

function echo(str){
var b = {
 r: page.rid,
 ak: page.authKey,
 t: "",
            m: str,
            ttt: new Date().getTime()
        };
        jQuery.extend(b, zhangZhiParam(Room.chatList._tracing));
b = '{"t":"msg_room", "content":' + jQuery.toJSON(b) + "}";
Room.Socket.proxy.convey(["command=sendmessage", "content=" + Room.Socket.proxy.encode(b)])
}

vi /usr/java/restart.sh

#!/bin/bash

/usr/java/apache-tomcat-8.0.45/bin/shutdown.sh

ps -ef|grep java|grep -v grep|awk '{print $2}'|xargs kill -9

/usr/java/apache-tomcat-8.0.45/bin/startup.sh

chmod +x restart.sh

crontab -e -u root

36 20 * * * /usr/java/restart.sh