安装PHP7:
安装php:
# tar zxvf php-7.1.2.tar.gz
# cd php-7.1.2
#./configure --prefix=/usr/local/php71 \
 --with-apxs2=/usr/local/apache24/bin/apxs \
 --with-curl \
 --with-freetype-dir \
 --with-gd \
 --with-gettext \
 --with-iconv-dir \
 --with-kerberos \
 --with-libdir=lib64 \
 --with-libxml-dir \
 --with-mysqli \
 --with-openssl \
 --with-pcre-regex \
 --with-pdo-mysql \
 --with-pdo-sqlite \
 --with-pear \
 --with-png-dir \
 --with-xmlrpc \
 --with-xsl \
 --with-zlib \
 --enable-fpm \
 --enable-bcmath \
 --enable-libxml \
 --enable-inline-optimization \
 --enable-gd-native-ttf \
 --enable-mbregex \
 --enable-mbstring \
 --enable-opcache \
 --enable-pcntl \
 --enable-shmop \
 --enable-soap \
 --enable-sockets \
 --enable-sysvsem \
 --enable-xml \
 --enable-zip
 
#make
#make install
最后到php的解压目录复制一下php的配置文件
#cp php.ini-development /usr/local/php/lib/php.ini 
因为默认配置文件目录为 Configuration File (php.ini) Path     /usr/local/php/lib
目前apache 还无法加载PHP解析模块
vim /usr/local/apache/conf/httpd.conf
在最下面加入一行AddHandler application/x-httpd-php .php
重启Apache服务,然后写一个简单的检测文件吧。
<?php
    phpinfo();
?>
把PHP加入环境变量
 
遇到的问题:

Sorry, I cannot run apxs. Possible reasons follow:

1. Perl is not installed

2. apxs was not found. Try to pass the path using --with-apxs2=/path/to/apxs

3. Apache was not built using --enable-so (the apxs usage page is displayed)

首先:看是是否安装  perl -v

若没有 则 wget  http://www.cpan.org/src/5.0/perl-5.16.1.tar.gz

tar  xzvf  perl-5.16.1.tar.gz

cd  perl-5.16.1.tar.gz

./Configure -des -Dprefix=/usr/local/perl

make

make install

然后,若有安装perl :

1、根据不能run apxs 。cd 到apache的bin目录下运行./apxs 运行结果

bash: ./apxs: /replace/with/path/to/perl/interpreter: bad interpreter: No such file or directory

2、vim apxs文件 找“/replace/with/path/to/perl/interpreter”关键字

在第一个行 :#!/replace/with/path/to/perl/interpreter -w

根据perl的安装目录 /usr/bin/perl

修改为:#! /usr/bin/perl -w

 
configure: error: libxml2 not found. Please check your libxml2 installation.
yum install libxml2-devel -y
 
configure: error: Cannot find OpenSSL's <evp.h>
yum install openssl-devel -y
 
configure: error: cURL version 7.10.5 or later is required to compile php with cURL support
yum install curl-devel -y
 
configure: error: png.h not found.
yum install libpng-devel -y
 
configure: error: freetype-config not found.
yum install freetype-devel -y
 
configure: error: xslt-config not found. Please reinstall the libxslt >= 1.1.0 distribution
yum install libxslt-devel -y
 
 
综上安装php大概需要的扩展:
yum install -y \
libxml2 libxml2-devel openssl openssl-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libmcrypt libmcrypt-devel 
 
启动 php-fpm 出现问题:
cd /usr/local/php71
cp etc/php-fpm.conf.default etc/php-fpm.conf
cp etc/php-fpm.d/www.conf.default etc/php-fpm.d/www.conf
 
参考文档:
https://www.linuxidc.com/Linux/2014-02/96761.htm
https://jingyan.baidu.com/article/fd8044fa15bc0a5031137ab8.html
 

CentOS7 下源代码安装php7的更多相关文章

  1. centos7下编译安装php-7.0.15(PHP-FPM)

    centos7下编译安装php-7.0.15(PHP-FPM) 一.下载php7源码包 http://php.net/downloads.php 如:php-7.0.15.tar.gz 二.安装所需依 ...

  2. CentOS7 下源代码安装apache2.4

    Apache httpd 2.4 源代码安装   https://httpd.apache.org/docs/2.4/install.html   这里选用Apache2.4版本. wget http ...

  3. centos7下编译安装php7.3

    一.下载php7.3的源码 https://www.php.net/downloads.php 下载php-7.3.4.tar.gz 二.安装gcc,gcc-c++,kernel-devel yum ...

  4. 在Centos7下源代码安装配置Nginx

    1.安装前准备开发环境安装pcre开发包:yum install -y pcre-devel 安装编译源码所需的工具和库:yum install gcc gcc-c++ ncurses-devel p ...

  5. CentOS7 下源代码安装mysql5.6

    ###### mysql ######### 引言:这里选用mysql5.6版本,5.7版本编译时间需要几个小时. 编译安装环境: yum -y install make gcc-c++ cmake ...

  6. centos7.6编译安装php7.2.11及redis/memcached/rabbitmq/openssl/curl等常见扩展

    centos7.6编译安装php7..11及redis/memcached/rabbitmq/openssl/curl等常见扩展 获取Php的编译参数方法: [root@eus-api-cms-bac ...

  7. Linux Centos7.2 编译安装PHP7.0.2

    操作环境: 1.系统:Centos7.2 2.服务:Nginx 1.下载PHP7.0.2的安装包解压,编译,安装: $ cd /usr/src/ $ wget http://cn2.php.net/d ...

  8. EnvironmentError: mysql_config not found问题解决(centos7下python安装mysql-python)

    centos7下python安装mysql-python模块,执行命令: pip install mysql-python 出现报错:EnvironmentError: mysql_config no ...

  9. Centos7下快速安装Mongo3.2

    Centos7下快速安装Mongo3.2 一般安装Mongo推荐源码安装,有时候为了快部署测试环境,或者仅仅是想装个mongo shell,这时候yum安装是最合适的方式, 下面介绍一下如何在Cent ...

随机推荐

  1. 再谈fedora23下Virutalbox的安装. --问题的关键在于 安装kernel-devel包

    首先, 要使用 virutalbox的 rpm 安装包 进行安装. 在安装的过程中, 如果提示 有一些包, 没有, dependencies not resolved, 比如libQt..libvpx ...

  2. 颠倒的价牌|2013年蓝桥杯A组题解析第四题-fishers

    颠倒的价牌 小李的店里专卖其它店中下架的样品电视机,可称为:样品电视专卖店. 其标价都是4位数字(即千元不等). 小李为了标价清晰.方便,使用了预制的类似数码管的标价签,只要用颜色笔涂数字就可以了(参 ...

  3. 【做题】codechefCOUNTARI——分块FFT

    记本题数组长度为\(n\),权值大小为\(m\). 首先,暴力显然是\(O(n^2)\)的. 先瞄一眼tag,然后发现这是FFT. 显然,问题的关键在于要满足i,j,k之间的位置关系.于是考虑分治FF ...

  4. (转)Autonomous_Vehicle_Paper_Reading_List

    Autonomous_Vehicle_Paper_Reading_List 2018-07-19 10:40:08 Reference:https://github.com/ZRZheng/Auton ...

  5. 论文笔记:ReNet: A Recurrent Neural Network Based Alternative to Convolutional Networks

    ReNet: A Recurrent Neural Network Based Alternative to Convolutional Networks2018-03-05  11:13:05   ...

  6. Google advertiser api开发概述——部分失败

    部分失败 某些 AdWords 服务允许您请求执行有效操作,而对失败的操作返回错误.此功能(称为部分失败)允许您在结束时单独处理失败的操作. 技术细节 要使用此功能,您需要设置此可选的 SOAP 标头 ...

  7. transient关键字详解

    作用 1,一旦变量被transient修饰,变量将不再是对象持久化的一部分,该变量内容在序列化后无法获得访问. 2,transient关键字只能修饰变量,而不能修饰方法和类.注意,本地变量是不能被tr ...

  8. 【Ruby】【基础】

    # [Ruby 块]=begin1 块由大量代码构成2 块中代码包含在{}内3 从与其相同名称的函数调用4 可以使用yield语句调用块=enddef test p '在test方法内' yield ...

  9. 同上两篇 这篇是关于shader的

    资源加载性能测试代码 与上篇所提出的测试代码一样,我们对于Shader资源的加载性能分析同样使用该测试代码.同时,我们将Shader文件制作成一定大小的AssetBundle文件,并逐一通过以下代码在 ...

  10. L1-048. 矩阵A乘以B

    水题不多说,直接上代码:#include<stdio.h> using namespace std; int main() { ][]; ][]; int m,n; int x,y; sc ...