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.安装PHP7

yum install php70w

二、编译安装

1.下载php7

wget -O php7.tar.gz http://cn2.php.net/get/php-7.0.4.tar.gz/from/this/mirror

2.解压php7

tar -xvf php7.tar.gz

3.进入php目录

cd php-7.0.4

4.安装依赖包

# 直接复制下面一行(不包括本行)
yum install 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 libxslt libxslt-devel

5.编译配置(如果出现错误,基本都是上一步的依赖文件没有安装所致) 
嫌麻烦的可以从这一步起参考PHP官方安装说明:http://php.net/manual/zh/install.unix.nginx.php

./configure --prefix=/usr/local/php --with-config-file-path=/etc --enable-fpm --with-fpm-user=nginx  --with-fpm-group=nginx --enable-inline-optimization --disable-debug --disable-rpath --enable-shared  --enable-soap --with-libxml-dir --with-xmlrpc --with-openssl --with-mcrypt --with-mhash --with-pcre-regex --with-sqlite3 --with-zlib --enable-bcmath --with-iconv --with-bz2 --enable-calendar --with-curl --with-cdb --enable-dom --enable-exif --enable-fileinfo --enable-filter --with-pcre-dir --enable-ftp --with-gd --with-openssl-dir --with-jpeg-dir --with-png-dir --with-zlib-dir  --with-freetype-dir --enable-gd-native-ttf --enable-gd-jis-conv --with-gettext --with-gmp --with-mhash --enable-json --enable-mbstring --enable-mbregex --enable-mbregex-backtrack --with-libmbfl --with-onig --enable-pdo --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-zlib-dir --with-pdo-sqlite --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-compression-support --with-pear --enable-opcache

6.正式安装

make && make install

7.配置环境变量

vim /etc/profile

在末尾追加

export PATH=/usr/local/php/bin:$PATH

执行命令使得改动立即生效

source /etc/profile

8.配置php-fpm 
需要在安装软件包目录

cp php.iniproduction /etc/php.ini
cp /usr/local/php/etc/phpfpm.conf.default /usr/local/php/etc/phpfpm.conf
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm

启动php-fpm

/etc/init.d/php-fpm start
时间: 2024-08-10 17:17:24

Centos7 安装 PHP7最新版的相关文章

【Linux】【Apatch Tomcat】CentOS7安装不最新版Apartch Tomcat环境

1.前言 相当嫌弃,博客园搞掉了我快写完的 Tomcat. 请先安装 :[Linux][Java]CentOS7安装最新版Java1.8.191运行开发环境 虽然安装Tomcat没啥技术,但是还是记录一下,方便后面萌新学习. 2.开始 1.获取下载地址 http://tomcat.apache.org/ · Tomcat 8.5.35 Released     2018-11-07 意思 :2018-11-07发布的 Tomcat 8.5.35 的发行版. · 当然你也可以选着最高版:Tomca

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.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

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

[TimLinux] docker CentOS7安装docker-ce最新版

1. 环境 $ lsb_release -a # 需要安装 redhat-lsb-core 包 LSB Version: :core-4.1-amd64:core-4.1-noarch Distributor ID: CentOS Description: CentOS Linux release 7.5.1804 (Core) Release: 7.5.1804 Codename: Core 2. 安装docker-ce 1. 移除旧版本: yum remove docker docker-c

centos7 安装nodejs 最新版

笔者在安装时,node为11.0.0版本.这里以11版本为例,以后更新,安装步骤时一致的. 下载node安装包到指定目录 wget https://npm.taobao.org/mirrors/node/v11.0.0/node-v11.0.0.tar.gz解压安装包 tar -xvf node-v11.0.0.tar.gz进入目录并安装相关插件 cd node-v11.0.0sudo yum install gcc gcc-c++ 进行默认配置并编译 ./configuremake编译大概需要

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