博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
centos7+ 安装 php7.2
阅读量:5142 次
发布时间:2019-06-13

本文共 2557 字,大约阅读时间需要 8 分钟。

yum install epel-release -yyum update
安装依赖
yum -y install wget vim pcre pcre-devel openssl openssl-devel libicu-devel gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel ncurses ncurses-devel curl curl-devel krb5-devel libidn libidn-devel openldap openldap-devel nss_ldap jemalloc-devel cmake boost-devel bison automake libevent libevent-devel gd gd-devel libtool* libmcrypt libmcrypt-devel mcrypt mhash libxslt libxslt-devel readline readline-devel gmp gmp-devel libcurl libcurl-devel openjpeg-devel

 

创建用户和组,并下载php安装包解压

 

cd /home/downloadgroupadd wwwuseradd -g www wwwwget http://am1.php.net/distributions/php-7.2.1.tar.gztar xvf php-7.2.1.tar.gzcd php-7.2.1

 

设置变量并开始源码编译:

 

cp -frp /usr/lib64/libldap* /usr/lib/
./configure --prefix=/usr/local/php \--with-config-file-path=/usr/local/php/etc \--enable-fpm \--with-fpm-user=www \--with-fpm-group=www \--enable-mysqlnd \--with-mysqli=mysqlnd \--with-pdo-mysql=mysqlnd \--enable-mysqlnd-compression-support \--with-iconv-dir \--with-freetype-dir \--with-jpeg-dir \--with-png-dir \--with-zlib \--with-libxml-dir \--enable-xml \--disable-rpath \--enable-bcmath \--enable-shmop \--enable-sysvsem \--enable-inline-optimization \--with-curl \--enable-mbregex \--enable-mbstring \--enable-intl \--with-mcrypt \--with-libmbfl \--enable-ftp \--with-gd \--enable-gd-jis-conv \--enable-gd-native-ttf \--with-openssl \--with-mhash \--enable-pcntl \--enable-sockets \--with-xmlrpc \--enable-zip \--enable-soap \--with-gettext \--disable-fileinfo \--enable-opcache \--with-pear \--enable-maintainer-zts \--with-ldap=shared \--without-gdbm

 

若无报错执行下一步安装,如果编译过程中出现错误,根据报错安装依赖包,通常不会出现这种问题。

注意:–enable-gd-jis-conv  此参数会导致Zabbix中文字符乱码,建议取消。

 

开始安装:

make -j 4 && make install

完成安装后配置php.ini文件:

cp php.ini-development /usr/local/php/etc/php.inicp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.confcp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf

 

创建system系统单元文件php-fpm启动脚本:

vim /usr/lib/systemd/system/php-fpm.service
[Unit]Description=The PHP FastCGI Process ManagerAfter=syslog.target network.target[Service]Type=simplePIDFile=/usr/local/php/var/run/php-fpm.pidExecStart=/usr/local/php/sbin/php-fpm --nodaemonize --fpm-config /usr/local/php/etc/php-fpm.confExecReload=/bin/kill -USR2 $MAINPID[Install]WantedBy=multi-user.target

启动php-fpm服务并加入开机自启动:

systemctl enable php-fpm.servicesystemctl restart php-fpm.service

 

转载于:https://www.cnblogs.com/weishanyun/p/10178906.html

你可能感兴趣的文章
深浅拷贝(十四)
查看>>
由级别和性格特征将程序员分类 ---看看你属于哪一种
查看>>
HDU 6370(并查集)
查看>>
BZOJ 1207(dp)
查看>>
PE知识复习之PE的导入表
查看>>
HDU 2076 夹角有多大(题目已修改,注意读题)
查看>>
洛谷P3676 小清新数据结构题(动态点分治)
查看>>
九校联考-DL24凉心模拟Day2T1 锻造(forging)
查看>>
洛谷 P3237 [HNOI2014]米特运输
查看>>
Attributes.Add用途与用法
查看>>
JavaScript面向对象初探——封装和继承
查看>>
L2-001 紧急救援 (dijkstra+dfs回溯路径)
查看>>
javascript 无限分类
查看>>
spring IOC装配Bean(注解方式)
查看>>
[面试算法题]有序列表删除节点-leetcode学习之旅(4)
查看>>
SpringBoot系列五:SpringBoot错误处理(数据验证、处理错误页、全局异常)
查看>>
kubernetes_book
查看>>
OpenFire 的安装和配置
查看>>
ZJOI2018游记Round1
查看>>
侧边栏广告和回到顶部
查看>>