您的位置:首页 > 运维架构 > Linux

新环境编译安装CentOS 7 php7

2017-10-21 09:39 330 查看

安装php

下载地址:wget http://cn2.php.net/distributions/php-7.0.12.tar.bz2

和nginx一样需要解压: tar -xvf 下载的文件

当然 php也需要安装缺少的文件,在这里进行编译安装产看缺少哪些文件

./configure –prefix=/usr/local/php70 –with-mysqli –with-pdo-mysql –with-iconv-dir –with-freetype-dir –with-jpeg-dir –with-png-dir –with-zlib –with-libxml-dir –enable-simplexml –enable-xml –disable-rpath –enable-bcmath –enable-soap –enable-zip –with-curl –enable-fpm –with-fpm-user=nobody –with-fpm-group=nobody –enable-mbstring –enable-sockets –with-mcrypt –with-gd –enable-gd-native-ttf –with-openssl –with-mhash –enable-opcache

下面是php报错解决方法:

报错 Cannot find OpenSSL’s evp.h

执行 yum install openssl openssl-devel

报错 Please reinstall the libcurl distribution

执行 yum -y install curl-devel

jpeglib.h not found

执行 yum install libjpeg.x86_64 libpng.x86_64 freetype.x86_64 libjpeg-devel.x86_64 libpng-devel.x86_64 freetype-devel.x86_64 -y

和执行 yum install libjpeg-devel

错误:checking for BZip2 in default path… not found configure: error: Please reinstall the BZip2 distribution 这是bzip2软件包没有安装

执行 yum install bzip2-devel.x86_64 -y

错误:configure: error: xpm.h not found.

执行 yum install libXpm-devel

错误: Unable to locate gmp.h

执行 yum install gmp-devel

错误: Unable to locate gmp.h

执行 yum install gmp-devel

错误:Unable to detect ICU prefix or /usr//bin/icu-config failed. Please verify ICU install prefix and make sure icu-config works

执行 yum install -y icu libicu libicu-devel

错误:mcrypt.h not found. Please reinstall libmcrypt.

执行 yum install php-mcrypt libmcrypt libmcrypt-devel

错误:mcrypt.h not found. Please reinstall libmcrypt.

执行 yum install php-mcrypt libmcrypt libmcrypt-devel

错误: configure: error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path

执行 yum install postgresql-devel

错误: configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution

执行 yum install libxslt-devel

configure: error: png.h not found.

yum install libpng libpng-devel.

error: Cannot find libpq-fe.h. Please specify correct PostgreSQL installation path

yum -y install postgresql-devel

error: Please reinstall the libcurl distribution -easy.h should be in curl-dir/include/curl/

yum install curl curl-devel

error: mcrypt.h not found. Please reinstall libmcrypt.

yum install php-mcrypt libmcrypt libmcrypt-devel

之后进行安装 使用 make && make install (这个可能时间会长一点)

安装成功后查看是否有php-fpm 使用whereis php-fpm

如果没有找到就安装失败了,找到了就启动。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  php centos