zoukankan      html  css  js  c++  java
  • php-7.4 编译安装

    环境 CentOS 7.9

    PHP下载: https://www.php.net/downloads.php 

    安装编译工具 yum groupinstall 'Development Tools'

    安装依赖包
    yum install -y autoconf krb5-devel openssl openssl-devel libxml2 libxml2-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 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 oniguruma oniguruma-devel

    添加用户 useradd -r -s /sbin/nologin php
    解压 tar zxf php-7.4.15.tar.gz
    cd php-7.4.15/

    ./configure --help 查看编译参数
    编译
    ./configure
    --prefix=/usr/local/php
    --with-config-file-path=/usr/local/php/etc
    --with-fpm-user=php
    --with-fpm-group=php
    --with-curl
    --enable-gd
    --with-gettext
    --with-iconv-dir
    --with-kerberos
    --with-libdir=lib64
    --with-mysqli
    --with-openssl
    --with-pdo-mysql
    --with-pdo-sqlite
    --with-pear
    --with-xmlrpc
    --with-xsl
    --with-zlib
    --with-bz2
    --with-mhash
    --enable-fpm
    --enable-bcmath
    --enable-inline-optimization
    --enable-mbregex
    --enable-mbstring
    --enable-opcache
    --enable-pcntl
    --enable-shmop
    --enable-soap
    --enable-sockets
    --enable-sysvsem
    --enable-sysvshm
    --enable-xml
    --enable-fpm

    * 编译若有组件缺失,使用 yum 进行安装或yum search 进行查找,若无法安装查找资料
    * 所有依赖 建议 yum 安装

    成功
    +--------------------------------------------------------------------+
    | License: |
    | This software is subject to the PHP License, available in this |
    | distribution in the file LICENSE. By continuing this installation |
    | process, you are bound by the terms of this license agreement. |
    | If you do not agree with the terms of this license, you must abort |
    | the installation process at this point. |
    +--------------------------------------------------------------------+

    Thank you for using PHP.

    执行 make
    make install


    写入环境变量
    echo "export PATH=$PATH:/usr/local/php/bin">>/etc/profile
    或 vim /etc/profile
    PATH=/usr/local/php/bin:$PATH

    重新加载 source /etc/profile

    配置php-fpm
    cp /usr/local/src/php-7.4.15/php.ini-production /etc/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
    cp /usr/local/src/php-7.4.15/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
    chmod +x /etc/init.d/php-fpm


    启动php-fpm
    service php-fpm start

    /etc/init.d/php-fpm start

    端口号修改:
    /usr/local/php/etc/php-fpm.d/www.conf

  • 相关阅读:
    Struts2_模块包含
    Struts2_访问Web元素
    Struts2_简单数据验证
    获取当前日期
    iOS NSMutableArray添加NSInteger元素
    iOS label换行 自适应
    iOS高德地图自定义annotation添加不同图片
    @property(nonatomic) UIViewAutoresizing autoresizingMask;
    HTML
    图片压缩
  • 原文地址:https://www.cnblogs.com/blue-t/p/14495584.html
Copyright © 2011-2022 走看看