安裝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