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

  • 相关阅读:
    「Luogu」2831愤怒的小鸟 (DFS+dp)
    LeetCode习题集
    递归的时间复杂度你真的懂吗?不是所有的二分递归都是logn级别
    [数据结构篇]谈一谈优先队列吧!
    论文爱好者(我不是)的福利
    Python 读微博留言进行情感分析(文本分类)
    python 多进程中的p.apply_async()
    记录本科论文开题报告修改过程
    KMP字符串匹配算法
    Pandas Timedelta
  • 原文地址:https://www.cnblogs.com/blue-t/p/14495584.html
Copyright © 2011-2022 走看看