Centos7 编译 PHP7.0.23

yum -y install epel-release libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel uuid uuid-devel libuuid-devel gcc bzip2 bzip2-devel gmp-devel  readline-devel libxslt-devel autoconf
cd /opt
wget http://cn2.php.net/distributions/php-7.0.23.tar.gz
tar -zxvf php-7.0.23.tar.gz
cd php-7.0.23

./configure \
--prefix=/opt/php/7.0.23 \
--with-config-file-path=/opt/php/7.0.23/etc \
--with-config-file-scan-dir=/opt/php/7.0.23/etc/conf.d \
--enable-fpm \
--enable-soap \
--with-openssl \
--with-openssl-dir \
--with-mcrypt \
--with-pcre-regex \
--with-zlib \
--with-iconv \
--with-bz2 \
--enable-calendar \
--with-curl \
--with-cdb \
--enable-dom \
--enable-exif \
--with-pcre-dir \
--enable-ftp \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-gettext \
--with-gmp \
--with-mhash \
--enable-mbstring \
--with-libmbfl \
--with-onig \
--enable-pdo \
--with-pdo-mysql \
--with-zlib-dir \
--with-readline \
--enable-session \
--enable-shmop \
--enable-simplexml \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-libxml-dir \
--with-xsl \
--enable-zip \
--enable-mysqlnd \
--with-mysqli \
--without-pear \
--disable-short-tags
make && make install

Installing shared extensions:     /opt/php/7.0.23/lib/php/extensions/no-debug-non-zts-20151012/
Installing PHP CLI binary:        /opt/php/7.0.23/bin/
Installing PHP CLI man page:      /opt/php/7.0.23/php/man/man1/
Installing PHP FPM binary:        /opt/php/7.0.23/sbin/
Installing PHP FPM defconfig:     /opt/php/7.0.23/etc/
Installing PHP FPM man page:      /opt/php/7.0.23/php/man/man8/
Installing PHP FPM status page:   /opt/php/7.0.23/php/php/fpm/
Installing phpdbg binary:         /opt/php/7.0.23/bin/
Installing phpdbg man page:       /opt/php/7.0.23/php/man/man1/
Installing PHP CGI binary:        /opt/php/7.0.23/bin/
Installing PHP CGI man page:      /opt/php/7.0.23/php/man/man1/
Installing build environment:     /opt/php/7.0.23/lib/php/build/
Installing header files:          /opt/php/7.0.23/include/php/
Installing helper programs:       /opt/php/7.0.23/bin/
  program: phpize
  program: php-config
Installing man pages:             /opt/php/7.0.23/php/man/man1/
  page: phpize.1
  page: php-config.1
/root/php-7.0.23/build/shtool install -c ext/phar/phar.phar /opt/php/7.0.23/bin
ln -s -f phar.phar /opt/php/7.0.23/bin/phar
Installing PDO headers:           /opt/php/7.0.23/include/php/ext/pdo/
cp php.ini-production /opt/php/7.0.23/etc/php.ini
copy sapi/fpm/php-fpm.service  /etc/systemd/system/php706.service
chown 755 /etc/systemd/system/php706.service
systemctl daemon-reload

加入启动项

systemctl start php706.service
systemctl senable php706.service

使用 sock 权限问题的解决方案

新建一个用户及组如 app

useradd app

设置一个复杂的密码

passwd app

更改 www.conf

vi  /opt/php/7.0.26/etc/php-fpm.d/www.conf

user = app
group =app
listen.owner = app
listen.group = app

安装新版 Mariadb

cd /etc/yum.repos.d/
vi /etc/yum.repos.d/MariaDB.repo

// 写入
[mariadb]
name = MariaDB
baseurl = https://mirrors.ustc.edu.cn/mariadb/yum/10.5/centos7-amd64/
gpgkey=https://mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1

//安装
yum -y install mariadb mariadb-server

新版的 nginx,可以到
 http://nginx.org/packages/centos/7/x86_64/RPMS/
 安装

你可能感兴趣的:(Centos7 编译 PHP7.0.23)