Our Customers

新闻资讯

centos7.x源码安装PHP

发布时间 : 2021/05/06
浏览次数 : 644
文章来源 : 合众启航
  1. 下载PHP包到/home/src,此处示例版本为7.4.18

    image.png

  2. 解压 tar xf php.tar.gz

  3. 编译参数

  4. ./configure
    --prefix=/usr/local/php
    --with-config-file-path=/usr/local/php/etc
    --enable-fpm
    --with-fpm-user=www
    --with-fpm-group=www
    --with-mysqli=mysqlnd
    --with-pdo-mysql=mysqlnd
    --with-iconv-dir
    --with-freetype-dir=/usr/local/freetype
    --with-mcrypt
    --with-jpeg-dir
    --with-png-dir
    --with-zlib
    --with-libxml-dir=/usr
    --enable-xml
    --disable-rpath
    --enable-inline-optimization
    --with-curl
    --enable-mbregex
    --enable-mbstring
    --with-gd
    --enable-gd-native-ttf
    --with-openssl
    --with-mhash
    --enable-pcntl
    --with-xmlrpc
    --enable-zip
    --enable-soap
    --with-gettext
    --enable-opcache
    --with-xsl
  5. 如果出现错误可能需要安装相关依赖

  6. yum install libxml2-devel -y
    yum install sqlite-devel -y
    yum install curl-devel -y
    yum install libxslt-devel -y
    yum install libjpeg-devel libpng-devel freetype-devel -y
  7. 如果出现No package 'oniguruma' found则需要安装以下

  8. yum install https://rpms.remirepo.net/enterprise/7/remi/x86_64/oniguruma5php-6.9.6-1.el7.remi.x86_64.rpm
    yum install https://rpms.remirepo.net/enterprise/7/remi/x86_64/oniguruma5php-devel-6.9.6-1.el7.remi.x86_64.rp

    执行安装 make && make install


18049412926