靳闯博客 记录是一种习惯,分享是一种态度
  • 波浪
  • 波浪
  • 波浪
  • 波浪
centos7 源码安装php7.2
发表于: | 分类: 技术积累 | 标签: Linux PHP | 评论:0 | 阅读: 1004

在centos7下面 源码安装php7.2


安装依赖包

yum install epel-release gcc gcc-c++ make zlib zlib-devel pcre pcre-devel freetype freetype-devel \
openssl openssl-devel curl curl-devel libxslt libxslt-devel gd gd-devel glibc blibc-devel libzip \
glib2 glib2-devel mcrypt libmcrypt-devel libmcrypt mhash libxslt-devel libicu-devel ncurses libzip-devel\
ncurses-devel libjpeg-devel libpng libpng-devel libxml2-devel bzip2 bzip2-devel libcurl-devel

#安装libiconv
wget https://www.jinchuang.org/novel/lnmp/libiconv-1.14.tar.gz
tar xf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure --prefix=/usr/lcoal/libiconv

#make 这里会有报错提前解决这个错误再make ,错误:https://blog.jinchuang.org/1700.html
cd srclib && sed -i -e '/gets is a security/d' ./stdio.in.h && cd ..
make -j8 && make install  #实测2核8G主机5分钟左右完成此步操作

下载、配置、编译安装

#php7.2中没有了--with-mcrypt --enable-gd-native-ttf --with-mysql 参数,所以这里我就不加这3个参数了

#-------------php7.3 libzip----------------
#php7.3中libzip版本要求》=0.11,如果你安装7.3版本:先卸载低版本再安装高版本的libzip
yum remove libzip libzip-devel -y
wget https://www.jinchuang.org/novel/lnmp/libzip-1.2.0.tar.gz
tar -zxvf libzip-1.2.0.tar.gz
cd libzip-1.2.0
./configure
make
make install
echo "/usr/lcoal/lib" >>/etc/ld.so.conf
ldconfig

#使用新版本libzip导致编译时的一个错误:usr/local/include/zip.h:59:21: fatal error: zipconf.h: No such file or direc
cp /usr/local/lib/libzip/include/zipconf.h /usr/local/include/zipconf.h
#--------------php7.3 libzip---------------

#开始配置安装
wget https://www.jinchuang.org/novel/lnmp/php-7.2.0.tar.gz
tar xf php-7.2.0.tar.gz
cd php-7.2.0
./configure \
--prefix=/usr/local/php7 \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--with-config-file-path=/usr/local/php7/etc \
--with-bz2 \
--with-curl \
--with-xsl \
--with-gd \
--with-openssl \
--with-mhash \
--with-jpeg-dir \
--with-png-dir \
--with-freetype-dir \
--with-iconv-dir=/usr/local/libiconv \
--with-gettext \
--with-libxml-dir \
--with-zlib \
--with-xmlrpc \
--with-pcre-regex \
--with-pear \
--with-pdo-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-libdir=lib64 \
--enable-mysqlnd \
--enable-intl \
--enable-dom \
--enable-xml \
--enable-simplexml \
--enable-fpm \
--enable-bcmath \
--enable-ftp \
--enable-sockets \
--enable-mbregex \
--enable-mbstring \
--enable-inline-optimization \
--enable-calendar \
--enable-static \
--enable-bcmath \
--enable-libxml \
--enable-opcache \
--enable-pcntl \
--enable-shmop \
--enable-soap \
--enable-sysvsem \
--enable-zip

make && make install (make 时间较久)

配置文件的调整

#php.ini 和 php-fpm.conf 两个配置文件
cp php.ini-production /usr/local/php7/etc/php.ini
cd /usr/local/php7/etc/
cp php-fpm.conf.default php-fpm.conf

#php-fpm.conf 引用这个目录中*.conf 配置文件,修改启动用户。端口号等
cd php-fpm.d/
cp www.conf.default www.conf

启动、停止

#启动
/usr/local/php7/sbin/php-fpm

#停止
pkill php-fpm 或者 ps -ef |grep php-fpm|grep -v grep |awk '{print $2}'|xargs kill

[root@localhost ~]# netstat -ltnp|grep php-fpm
tcp        0      0 127.0.0.1:9000          0.0.0.0:*               LISTEN      18359/php-fpm: pool

商业转载请联系作者获得授权,非商业转载请注明出处,谢谢合作。


如果这篇文章帮助到了你,我感到十分荣幸!

或许你不想写点什么·但我依旧在这里

icon_mrgreen.pngicon_neutral.pngicon_twisted.pngicon_arrow.pngicon_eek.pngicon_smile.pngicon_confused.pngicon_cool.pngicon_evil.pngicon_biggrin.pngicon_idea.pngicon_redface.pngicon_razz.pngicon_rolleyes.pngicon_wink.pngicon_cry.pngicon_surprised.pngicon_lol.pngicon_mad.pngicon_sad.pngicon_exclaim.pngicon_question.png2018new_aini_org.png2018new_baobao_thumb.png2018new_erha_org.png2018new_kuxiao_thumb.png2018new_yun_thumb.png2018new_hufen_thumb.png2018new_gui_org.png2018new_xiaoerbuyu_org.png2018new_heixian_thumb.png2018new_wabi_thumb.png2018new_tianping_thumb.png

站点地图 网站地图
豫ICP备17003270号 | Copyright © 2019 💖 靳闯博客
Typecho🍹Sgreen
TOP