美文网首页
php7.3.1在Contos7下编译安装

php7.3.1在Contos7下编译安装

作者: object_徐振 | 来源:发表于2019-01-19 17:09 被阅读0次

1. 安装依赖库


  • 安装支持库
    yum install screen gcc git vim wget openssl curl
    yum install gmp-devel libc-client-devel bzip2-devel enchant-devel libwebp-devel libXpm-devel openldap openldap-devel php-pspell aspell-devel readline-devel libtidy-devel libxslt-devel libxml2-devel openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel autoconf
    
  • 解决yum包不存在问题
    wget http://www6.atomicorp.com/channels/atomic/centos/7/x86_64/RPMS/atomic-release-1.0-21.el7.art.noarch.rpm
    rpm -Uvh atomic-release*rpm
    
  • libc-client 和 libldap 找不到
    ln -s /usr/lib64/libc-client.so /usr/lib/libc-client.so
    cp -frp /usr/lib64/libldap* /usr/lib/
    

2. 编译安装php


  • 下载php7.3.1源码

    wget http://php.net/distributions/php-7.3.1.tar.gz && tar -zxvf php-7.3.1.tar.gz && cd  php-7.3.1
    
  • 配置要安装的库

    ./buildconf --force
    
    ./configure \
    --prefix=/usr/local/php \
    --with-config-file-path=/usr/local/php/etc \
    --with-config-file-scan-dir=/usr/local/php/conf.d \
    --with-sqlite3 \
    --with-pdo-sqlite \
    --with-mysqli=mysqlnd \
    --with-pdo-mysql=mysqlnd \
    --enable-posix \
    --enable-pcntl \
    --enable-shmop \
    --enable-sysvshm \
    --enable-sysvsem \
    --enable-sysvmsg \
    --enable-phar \
    --enable-zip \
    --with-zlib \
    --with-zlib-dir \
    --with-bz2 \
    --with-gd \
    --enable-gd-jis-conv \
    --with-webp-dir \
    --with-jpeg-dir \
    --with-png-dir \
    --with-xpm-dir \
    --with-freetype-dir \
    --enable-exif \
    --enable-json \
    --enable-libxml \
    --with-libxml-dir \
    --enable-xml \
    --enable-xmlreader \
    --enable-xmlwriter \
    --enable-simplexml \
    --with-pear \
    --with-xsl \
    --enable-dom \
    --enable-soap \
    --enable-wddx \
    --with-xmlrpc \
    --enable-ctype \
    --enable-filter \
    --with-pcre-regex \
    --with-pcre-jit \
    --with-enchant \
    --with-pspell \
    --enable-fileinfo \
    --enable-mbstring \
    --with-iconv \
    --enable-hash \
    --with-openssl \
    --enable-bcmath \
    --with-gmp \
    --enable-session \
    --enable-sockets \
    --enable-ftp \
    --with-curl \
    --with-ldap \
    --with-ldap-sasl \
    --with-imap \
    --with-kerberos \
    --with-imap-ssl \
    --enable-calendar \
    --with-gettext \
    --with-tidy \
    --with-readline \
    --enable-tokenizer \
    --enable-opcache \
    --enable-cli \
    --enable-cgi \
    --enable-fpm \
    --enable-phpdbg
    
  • 编译安装

    make -j `grep processor /proc/cpuinfo | wc -l` && make install
    
  • 编译报错

    1. checking for libzip... configure: error: system libzip must be upgraded to version >= 0.11

      yum remove libzip libzip-devel
      wget https://nih.at/libzip/libzip-1.2.0.tar.gz
      tar -zxvf libzip-1.2.0.tar.gz
      cd libzip-1.2.0
      ./configure
      make
      make install
      
    2. collect2: error: ld returned 1 exit status

      vim Makefile 找到 开头是 'EXTRA_LIBS' 这一行 在结尾加上 '-llber'
      如果还报错再加上'-liconv'

    3. fatal error: zipconf.h: No such file or directory

      //查找 zipconf.h
      find / -name zipconf.h
      // 复制 zipconf.h 到 /usr/local/include/
      cp /usr/local/lib/libzip/include/zipconf.h /usr/local/include/

3. 系统配置


cp php.ini-production /usr/local/php/etc/php.ini
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm

4. 配置全局变量

vim /etc/profile
export PATH=$PATH:/usr/local/php/bin
source /etc/profile

5. php.ini


  • 设置时区
     date.timezone = Asia/Shanghai
    
  • 开启 opcache 字节码缓存
        sysctl vm.nr_hugepages=512
        # 将下面内容添加至php.ini 开启OPcache
        [Zend OPcache]
        zend_extension=opcache.so
        opcache.enable=1
        opcache.enable_cli=1
        opcache.huge_code_pages=1
        opcache.file_cache=/tmp
    

相关文章

  • php7.3.1在Contos7下编译安装

    1. 安装依赖库 安装支持库yum install screen gcc git vim wget openssl...

  • contos7安装使用rabbitMq

    项目中要使用rabbitmq,所以今天就参照网上的博客在contos7上安装rabbitmq 1).首先需要安装e...

  • nginx安装mysql8.0

    【安装步骤】 contos7默认安装了mariadb数据库,这里把他移除:yum remove mariadb-l...

  • Ecs服务器上快速安装Mysql

    【安装步骤】 1、contos7默认安装了mariadb数据库,这里把他移除:yum remove mariadb...

  • freeswitch安装

    在ubuntu 20.04 下安装 freeswitch 1.10.7 安装依赖 安装需要通过源码编译的依赖 安装...

  • Linux 环境下源码编译安装 NodeJS

    在Linux环境下安装 NodeJS 有三种方式: 源码编译安装 使用预编译安装包安装 使用包管理器安装 (不推荐...

  • 在ubuntu下编译安装gmt

    GMT安装方法有好几种:(1)从官方发布的二进制文件安装;(2)在Mac, Linux系统下有自动安装命令;(3)...

  • ffmpeg初体验之下载安装

    下载 1.在mac下,优先安装brew 2.安装ffmpeg 3.安装编译FFmpeg所需依赖 编译 详见官网ff...

  • windows下搭建bitcoin调试环境

    1. bitcoin编译: bitcoin可以通过WSL在windows下编译、安装(当然也可以安装虚拟机或者do...

  • php 手动编译添加扩展

    在完成 php的编译安装后, 发现没有编译某此模块。手动添加安装。php源码编译安装 编译安装 在php源码包中 ...

网友评论

      本文标题:php7.3.1在Contos7下编译安装

      本文链接:https://www.haomeiwen.com/subject/rkezdqtx.html