• centos7 7.3php编译安装


    1.首先更新依赖包。

    yum -y update
     

    2.安装依赖包

    yum -y install 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 zlib zlib-devel glibc glibc-devel glib2 glib2-devel ncurses curl gdbm-devel db4-devel libXpm-devel libX11-devel gd-devel gmp-devel expat-devel xmlrpc-c xmlrpc-c-devel libicu-devel libmcrypt-devel libmemcached-devel libzip gcc-c++
    3.转到 /usr/local/src 目录,下载php7.3.5

    cd /usr/local/src
    wget https://www.php.net/distributions/php-7.3.5.tar.gz
    4.解压安装包,并进入目录

    tar -zxvf php-7.3.5.tar.gz
    cd php-7.3.5
    5.添加用户和组

    groupadd www
    useradd -g www www
     

    6.开始编译

    ./configure
    --prefix=/usr/local/php
    --enable-fpm
    --with-fpm-user=www
    --with-fpm-group=www
    --with-config-file-path=/usr/local/php/conf
    --disable-rpath
    --enable-soap
    --with-libxml-dir
    --with-xmlrpc
    --with-openssl
    --with-mhash
    --with-pcre-regex
    --with-zlib
    --enable-bcmath
    --with-bz2
    --enable-calendar
    --with-curl
    --enable-exif
    --with-pcre-dir
    --enable-ftp
    --with-gd
    --with-openssl-dir
    --with-jpeg-dir
    --with-png-dir
    --with-zlib-dir
    --with-freetype-dir
    --enable-gd-jis-conv
    --with-gettext
    --with-gmp
    --with-mhash
    --enable-mbstring
    --with-onig
    --with-mysqli=mysqlnd
    --with-pdo-mysql=mysqlnd
    --with-zlib-dir
    --with-readline
    --enable-shmop
    --enable-sockets
    --enable-sysvmsg
    --enable-sysvsem
    --enable-sysvshm
    --enable-wddx
    --with-libxml-dir
    --with-xsl
    --enable-zip
    --with-pear
    这里会提示 configure: error: Please reinstall the libzip distribution,我们需要溢出libzip,手动安装最新版本,

    先编译安装最新版cmake

    cd /usr/local/src
    wget https://github.com/Kitware/CMake/releases/download/v3.14.3/cmake-3.14.3.tar.gz
    tar -zxvf cmake-3.14.3.tar.gz
    cd cmake-3.14.3
    ./bootstrap
    make && make install

     再编译安装libzip

    yum remove libzip -y
    cd /usr/local/src
    wget https://libzip.org/download/libzip-1.5.2.tar.gz
    tar -zxvf libzip-1.5.2.tar.gz
    cd libzip-1.5.2
    mkdir build
    cd build
    cmake ..
    make && make install
    再次编译php7.3,继续报错 error: off_t undefined; check your library configuration

    执行以下命令

    vi /etc/ld.so.conf
    #添加如下几行
    /usr/local/lib64
    /usr/local/lib
    /usr/lib
    /usr/lib64
    #保存退出
    :wq
    ldconfig -v # 使之生效
    再次编译PHP7.3 

    make && make install
    7.编译完成后,添加环境变量

    vi /etc/profile
    #添加以下内容到最后
    PATH=$PATH:/usr/local/php/bin
    export PATH
    #刷新环境变量
    source /etc/profile

    8.编辑配置文件

    cp php.ini-production /usr/local/php/conf/php.ini
    cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
    cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
    9.把systemctl文件加入开机启动文件

    cp sapi/fpm/php-fpm.service /usr/lib/systemd/system/php-fpm.service
    systemctl start php-fpm.service
    systemctl enable php-fpm.service
     
    ---------------------
    版权声明:本文为CSDN博主「ijijni」的原创文章,遵循CC 4.0 by-sa版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/ijijni/article/details/89913738

  • 相关阅读:
    JavaScript高级程序设计学习笔记事件(一)(事件流、事件处理程序/事件侦听器)
    JavaScript高级程序设计学习笔记事件(二)(事件对象DOM中的事件对象/IE中的事件对象/跨浏览器的事件对象)
    闭包学习小记
    JavaScript高级程序设计学习笔记DOM(一)(节点层次Node类型节点关系/操作节点)
    打印网页内容
    尝试写第一个js插件 图片轮播
    JavaScript高级程序设计学习笔记面向对象的程序设计(一) 创建对象 (工厂模式、构造函数模式、原型模式等)
    jQuery二维码插件 jquery.qrcode.js
    ajax请求地址后加随机数防止浏览器缓存
    location.href 和document.referrer、event.keyCode、setTimeout 与setInterval、前置与后置型递增递减操作符
  • 原文地址:https://www.cnblogs.com/xiexun/p/11359374.html
Copyright © 2020-2023  润新知