1.麒麟v10 安装php5.6
1.修改仓库
#有网络的,加DNS就行
#添加访问互联路由
cat > /etc/resolv.conf <<EOF
nameserver 114.114.114.114
nameserver 223.5.5.5
nameserver 8.8.8.8
EOF
cat /etc/resolv.conf
#没有网络的使用本地镜像
mkdir -p /etc/yum.repos.d/bak
mv /etc/yum.repos.d/*repo /etc/yum.repos.d/bak
cat > /etc/yum.repos.d/dvd.repo <<EOF
[OEL7]
name=OEL7
baseurl=file:///media/
gpgcheck=0
enabled=1
EOF
mount /dev/cdrom /media/
2.安装低版本openssl-1.0.2k插件
wget https://www.openssl.org/source/openssl-1.0.2k.tar.gz
tar -zxvf openssl-1.0.2k.tar.gz && cd /root/openssl-1.0.2k
./Configure --prefix=/opt/build --openssldir=/opt/build -fPIC -shared linux-x86_64 -Wl,--enable-new-dtags,-rpath,'/opt/build/lib';
make && make install
3.安装php-5.6.40
wget http://mirrors.sohu.com/php/php-5.6.40.tar.gz
cd /root && tar -zxvf php-5.6.40.tar.gz && cd /root/php-5.6.40
mkdir -p /data/app/
yum -y install gcc curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel pcre pcre-devel libxslt libxslt-devel bzip2 bzip2-devel pcre2 pcre2-devel zlib zlib-devel readline-devel
#使用环境变量,不然会使用麒麟高版本的openssl就会报错
export PKG_CONFIG_PATH=/opt/build/lib/pkgconfig;
export LD_LIBRARY_PATH=/opt/build/lib;
export OPENSSL_CONF=/etc/ssl
./configure --prefix=/data/app/php --with-openssl=/opt/build -enable-fpm --with-mysql --with-mysqli --with-zlib --with-curl --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-openssl --enable-mbstring --enable-xml --enable-session --enable-ftp --enable-pdo --with-fpm-user=www --with-fpm-group=www --with-pdo-mysql
make && make install && /data/app/php/bin/php -v
#cp php.ini-development /data/app/php/lib/php.ini
cp php.ini-development /data/app/php/etc/php.ini
cp /data/app/php/etc/php-fpm.conf.default /data/app/php/etc/php-fpm.conf
cat > /usr/lib/systemd/system/php.service <<-'EOF'
[Unit]
Description=The PHP FastCGI Process Manager
After=syslog.target network.target
[Service]
Type=simple
PIDFile=/data/app/php/var/run/php-fpm.pid
ExecStart=/data/app/php/sbin/php-fpm --nodaemonize --fpm-config /data/app/php/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID
[Install]
WantedBy=multi-user.target
EOF
groupadd www && useradd -g www www
systemctl daemon-reload
systemctl enable php
systemctl restart php && systemctl status php