腾讯云 Centos 搭建PHP7.3测试环境

需求

需要安装测试环境,这里记录一下

yum update -y
mkdir /usr/local/services -pv
mkdir /usr/local/src -pv
yum -y install libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel libxslt libxslt-devel
yum install openssh-server vim net-tools iproute htop lsof iostat tcpdump git atop wget supervisor dstat unzip mysql redis memcached nginx telnet nc autoconf gcc  gcc-c++ -y && yum clean all
#
useradd nginx 
#
PREFIX_PATH="/usr/local/services"
CPUS=`cat /proc/cpuinfo |grep "processor"|wc -l`
#安装 cmake 默认版本较低
wget -P /usr/local/src http://www.cmake.org/files/v3.1/cmake-3.1.1.tar.gz
tar -zxvf /usr/local/src/cmake-3.1.1.tar.gz -C /usr/local/src/
/usr/local/src/cmake-3.1.1/bootstrap
cd /usr/local/src/cmake-3.1.1/ && ./bootstrap && make && make install
#安装 libzip
curl https://libzip.org/download/libzip-1.5.1.tar.gz -O /usr/local/src/libzip-1.5.1.tar.gz
tar -zxvf /usr/local/src/libzip-1.5.1.tar.gz -C /usr/local/src/
mkdir /usr/local/src/libzip-1.5.1/build && cd /usr/local/src/libzip-1.5.1/build && cmake .. && make && make install
# 安装 bison-2.4.1.tar.gz
# wget -P /usr/local/src http://ftp.gnu.org/gnu/bison/bison-2.4.1.tar.gz
# tar -zxvf /usr/local/src/bison-2.4.1.tar.gz -C /usr/local/src/
# 安装PHP 
curl https://www.php.net/distributions/php-7.3.16.tar.gz -o /usr/local/src/php-7.3.16.tar.gz
tar xvf /usr/local/src/php-7.3.16.tar.gz -C /usr/local/src/
cd /usr/local/src/php-7.3.16/ && ./configure --prefix=/usr/local/services/php/7.3.16 \
--with-config-file-path=/usr/local/etc/php/7.3.16 \
--with-config-file-scan-dir=/usr/local/etc/php/7.3.16/conf.d \
--with-openssl=/usr/local/opt/openssl \
--with-mysqli \
--with-pdo-mysql \
--with-iconv-dir \
--with-freetype-dir=/usr/local/freetype \
--with-zlib \
--with-jpeg-dir \
--with-png-dir \
--with-libxml-dir=/usr/bin/xml2-config \
--enable-xml \
--disable-rpath \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--enable-mbregex \
--enable-mbstring \
--enable-ftp \
--with-gd \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--without-pear \
--enable-fpm \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-maintainer-zts \
--enable-mysqlnd
cd /usr/local/src/php-7.3.16 
make && make install

ln -s /usr/local/services/php/7.3.16/bin/php /usr/local/bin/php
ln -s /usr/local/services/php/7.3.16/sbin/php-fpm /usr/local/bin/php-fpm

cd /usr/local/services/php/7.3.16/etc/ 
cp php-fpm.conf.default php-fpm.conf
cp php-fpm.d/www.conf.default php-fpm.d/www.conf

安装成功后默认没有pecl 需要手动安装

wget http://pear.php.net/go-pear.phar
php go-pear.phar

选择默认的,直接回车就好。

你可能感兴趣的:(linux,工具,CentOS,7)