安装php7,php-fpm


yum安装php7

删除之前的版本

#yum remove php

rpm 安装 Php7 相应的 yum源

CentOS/RHEL 7.x:

# 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

CentOS/RHEL 6.x:

# rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

yum安装php7

yum install php70w php70w-opcache

安装其他插件(选装)
注:如果安装pear,需要安装php70w-devel

php70w
php70w-bcmath 
php70w-cli
php70w-common
php70w-dba 
php70w-devel 
php70w-embedded
php70w-enchant 
php70w-fpm 
php70w-gd 
php70w-imap 
php70w-interbase
php70w-intl 
php70w-ldap 
php70w-mbstring 
php70w-mcrypt 
php70w-mysql
php70w-mysqlnd
php70w-odbc
php70w-opcache
php70w-pdo 
php70w-pdo_dblib 
php70w-pear 
php70w-pecl-apcu 
php70w-pecl-imagick 
php70w-pecl-xdebug 
php70w-pgsql 
php70w-phpdbg 
php70w-process 
php70w-pspell 
php70w-recode 
php70w-snmp 
php70w-soap 
php70w-tidy 
php70w-xml 
php70w-xmlrp

编译安装php7

配置(configure)、编译(make)、安装(make install)

使用configure --help

编译安装一定要指定定prefix,这是安装目录,会把所有文件限制在这个目录,卸载时只需要删除那个目录就可以,如果不指定会安装到很多地方,后边删除不方便。

Configuration:
--cache-file=FILE       cache test results in FILE
--help                  print this message
--no-create             do not create output files
--quiet, --silent       do not print `checking...' messages
--version               print the version of autoconf that created configure
Directory and file names:
--prefix=PREFIX         install architecture-independent files in PREFIX
[/usr/local]
--exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX

注意
内存小于1G安装往往会出错,在编译参数后面加上一行内容--disable-fileinfo

其他配置参数

--exec-prefix=EXEC-PREFIX
可以把体系相关的文件安装到一个不同的位置,而不是PREFIX设置的地方.这样做可以比较方便地在不同主机之间共享体系相关的文件
--bindir=DIRECTORY
为可执行程序声明目录,缺省是 EXEC-PREFIX/bin
--datadir=DIRECTORY
设置所安装的程序需要的只读文件的目录.缺省是 PREFIX/share
--sysconfdir=DIRECTORY
用于各种各样配置文件的目录,缺省为 PREFIX/etc
--libdir=DIRECTORY
库文件和动态装载模块的目录.缺省是 EXEC-PREFIX/lib
--includedir=DIRECTORY
C 和 C++ 头文件的目录.缺省是 PREFIX/include
--docdir=DIRECTORY
文档文件,(除 “man(手册页)”以外, 将被安装到这个目录.缺省是 PREFIX/doc
--mandir=DIRECTORY
随着程序一起带的手册页 将安装到这个目录.在它们相应的manx子目录里. 缺省是PREFIX/man
--with-includes=DIRECTORIES
DIRECTORIES 是一系列冒号分隔的目录,这些目录将被加入编译器的头文件 搜索列表中.如果你有一些可选的包(比如 GNU Readline)安装在 非标准位置,你就必须使用这个选项,以及可能还有相应的 --with-libraries 选项.
--with-libraries=DIRECTORIES
DIRECTORIES 是一系列冒号分隔的目录,这些目录是用于查找库文件的. 如果你有一些包安装在非标准位置,你可能就需要使用这个选项 (以及对应的--with-includes选项)
--enable-XXX
打开XXX支持
--with-XXX
制作XXX模块

安装实例

在之前安装需要的拓展

yum install libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel libmcrypt libmcrypt-devel mcrypt mhash

配置:

./configure \
--prefix=/usr/local/php7 \
--bindir=/usr/local/php7/bin \
--sbindir=/usr/local/php7/sbin \
--includedir=/usr/local/php7/include \
--libdir=/usr/local/php7/lib/php \
--with-config-file-path=/usr/local/php7/etc \
--with-mysql-sock=/var/run/mysql/mysql.sock \
--with-mcrypt=/usr/include \
--with-mhash \
--with-openssl \
--enable-mysqlnd \
--with-gd \
--with-iconv \
--with-zlib \
--enable-zip \
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-xml \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-mbstring \
--enable-ftp \
--enable-gd-native-ttf \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-soap \
--with-pear=/usr/local/php7/pear \
--with-gettext \
--enable-session \
--with-curl=/usr/local/curl \
--enable-opcache \
--enable-fpm \
--with-fpm-user=nginx \
--with-fpm-group=nginx

安装之后可以通过下边的命令获得安装时的configure选项

php -i | grep configure | sed -e "s/Configure Command => //; s/'//g"


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM