• 首页 首页 icon
  • 工具库 工具库 icon
    • IP查询 IP查询 icon
  • 内容库 内容库 icon
    • 快讯库 快讯库 icon
    • 精品库 精品库 icon
    • 问答库 问答库 icon
  • 更多 更多 icon
    • 服务条款 服务条款 icon

CentOS 7 yum 方式安装 php

武飞扬头像
哈哈虎123
帮助11

官方文档里面没有 针对 CentOS 系统的安装说明,只能下载源码编译安装
https://www.php.net/manual/en/install.php

网上有一些 yum 源,主要有 https://mirror.webtatic.comRemi;s rpm repository
webtatic 的更新日期停留在 2016 年,Remi 比较新,所以选择 Remi;s rpm repository

安装步骤

  1. 安装 EPEL ( Extra Packages for Enterprise Linux )
    yum install epel-release

  2. 安装 yum-utils ,用于 yum-config-manager 管理 rpm
    yum -y install yum-utils

  3. 安装 remi rpm 源
    yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm

  4. 查询
    yum repolist all |grep php
    全都是禁用状态

     ......
     remi-php80                          Remi's PHP 8.0 RPM repository f 禁用
     remi-php80-debuginfo/x86_64         Remi's PHP 8.0 RPM repository f 禁用
     remi-php80-test                     Remi's PHP 8.0 test RPM reposit 禁用
     remi-php80-test-debuginfo/x86_64    Remi's PHP 8.0 test RPM reposit 禁用
     remi-php81                          Remi's PHP 8.1 RPM repository f 禁用
     remi-php81-debuginfo/x86_64         Remi's PHP 8.1 RPM repository f 禁用
     remi-php81-test                     Remi's PHP 8.1 test RPM reposit 禁用
     remi-php81-test-debuginfo/x86_64    Remi's PHP 8.1 test RPM reposit 禁用
     remi-php82                          Remi's PHP 8.2 RPM repository f 禁用:    299
     remi-php82-debuginfo/x86_64         Remi's PHP 8.2 RPM repository f 禁用
     remi-php82-test                     Remi's PHP 8.2 test RPM reposit 禁用
     remi-php82-test-debuginfo/x86_64    Remi's PHP 8.2 test RPM reposit 禁用
    
  5. 启动需要安装的 php 版本的 rpm 源
    yum-config-manager --enable remi-php82

  6. 安装 php 以及可能需要的模块

     yum -y install php php-cli php-fpm php-mysqlnd php-zip php-devel php-gd php-mcrypt php-mbstring php-curl php-xml php-pear php-bcmath php-json php-redis php-calendar php-bcmath php-sockets php-session php-snmp 
    
  7. 安装完成,查询确认.
    php -v

     PHP 8.2.3 (cli) (built: Feb 14 2023 01:06:39) (NTS gcc x86_64)
     Copyright (c) The PHP Group
     Zend Engine v4.2.3, Copyright (c) Zend Technologies
    

systemctl status php-fpm

● php-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; disabled; vendor preset: disabled)
   Active: inactive (dead)

php -m

这篇好文章是转载于:学新通技术网

  • 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
  • 本站站名: 学新通技术网
  • 本文地址: /boutique/detail/tanhfijkjf
系列文章
更多 icon
同类精品
更多 icon
继续加载