Centos7安装PHP7

Posted Milton

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Centos7安装PHP7相关的知识,希望对你有一定的参考价值。

 

 

安装依赖

yum update
yum
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 libxslt libxslt-devel

编译

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

make
make install

 

出现 configure: error: mcrypt.h not found. Please reinstall libmcrypt时

cd /usr/local/src
wget http://softlayer.dl.sourceforge.net/sourceforge/mcrypt/libmcrypt-2.5.8.tar.gz
tar -zxvf libmcrypt-2.5.8.tar.gz
cd /usr/local/src/libmcrypt-2.5.8
./configure --prefix=/usr/local
make
make install

出现 Don‘t know how to define struct flock on this system, set --enable-opcache=no

[[email protected] php-7.1.0]# vi /etc/ld.so.conf  
include ld.so.conf.d/*.conf
# 添加这行
/usr/local/lib
~                                

 





以上是关于Centos7安装PHP7的主要内容,如果未能解决你的问题,请参考以下文章

centos7 安装nginx和php7

Centos7 安装 PHP7最新版

centos7 源码安装php7

Centos7下安装php7

源码安装CentOs7下的PHP7

Centos7 安装PHP7版本