centos7+ 安装 php7.2

yum install epel-release -y
yum 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/download
groupadd www
useradd -g www www
wget http://am1.php.net/distributions/php-7.2.1.tar.gz
tar xvf php-7.2.1.tar.gz
cd 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.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp /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 Manager
After=syslog.target network.target

[Service]
Type=simple
PIDFile=/usr/local/php/var/run/php-fpm.pid
ExecStart=/usr/local/php/sbin/php-fpm --nodaemonize --fpm-config /usr/local/php/etc/php-fpm.conf
ExecReload=/bin/kill -USR2 $MAINPID

[Install]
WantedBy=multi-user.target

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

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

原文地址:https://www.cnblogs.com/weishanyun/p/10178906.html

时间: 2024-11-05 14:44:36

centos7+ 安装 php7.2的相关文章

Centos7 安装 PHP7最新版

Centos7 安装 PHP7最新版 PHP编译安装适合Centos6以及Centos7 PHP 一.简单安装 通过yum 1.安装epel-release rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm 2.安装PHP7的rpm源 rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm 3.安装PH

Centos7 安装PHP7版本

1. 更换rpm 源,执行下面两个 rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm //查看yum search php71w 2. 安装php7.1 以及扩展yum install php71w php71w-fpm php71w-cli php71w-

CentOS7 安装php7.2 傻瓜式 并与nginx配合使用

安装源 安装 EPEL 软件包: $ sudo yum install epel-release 安装 remi 源: $ sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm 安装 yum 扩展包: $ sudo yum install yum-utils 启用 remi 仓库: $ sudo yum-config-manager --enable remi-php72 $ sudo yum update

Centos7安装PHP7

安装依赖 yum updateyum install gcc-c++ libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel l

centos7 安装PHP7

gccyum install gcc#libxml2yum install libxml2-devel #添加用户useradd -s /sbin/nologin php-fpm #打开src目录 cd /usr/local/src #下载安装包wget https://www.php.net/distributions/php-7.2.3.tar.gz cd php-7.2.3 ./configure --prefix=/usr/local/php --sysconfdir=/usr/loca

centos7 安装php7,报错cannot get uid for user nginx

centos7 安装nginx和php7

centos7 安装nginx和php7 centos7系统安装php7会出现一些奇奇怪怪的问题,耽误时间,影响效率,这里推荐直接yum安装 1.在开始安装 Nginx 和 php7-fpm 之前,我们还学要先添加 EPEL 包的仓库源.使用如下命令:      yum -y install epel-release 然后我们还需要为 php7-fpm 添加另外一个仓库.互联网中有很个远程仓库提供了 PHP 7 系列包,我在这里使用的是 webtatic. 添加 PHP7-FPM webtati

centos7.3安装php7.0

需求:在Centos7.3下搭建LNMP环境 文章转载自:http://blog.csdn.net/wszll_alex/article/details/76285324 作者:狂热森林 1. 关闭防火墙和selinux 打开文件selinux vim /etc/sysconfig/selinux 将文件中SELINUX=enforcing改为disabled,然后执行"setenforce 0″不用重启地关闭selinux. SELINUX=disabled 关闭放火墙 systemctl s

centos7 通过YUM安装 PHP7 NGINX1.1.8 POSTGRESQL9.5

CENTOS的策略实在是太保守了,现在PHP的官方包才5.3  PHP7性能大幅提高,不尝试下对不起自己. 1.最小化安装CENTOS7 2.更新源: yum update reboot 3.安装扩展源: yum install epel-release 4.安装工具软件: yum install wget unzip unrar 5.安装PHP7.0扩展源: wget http://rpms.famillecollet.com/enterprise/remi-release-7.rpm rpm