CentOS使用YUM安装php运行环境,包含php,php
我们要使用yum来安装php-fpm和比较新版本的php,nginx,mysql-server的话, 首先得给yum添加几个源,CentOS默认的源里面软件比较旧,有些软件、库还没有。 EPEL源: Extra Packages for Enterprise Linux (or EPEL)或者叫企业版 Linux 附加软件包, 是一个由特
我们要使用yum来安装php-fpm和比较新版本的php,nginx,mysql-server的话, 首先得给yum添加几个源,CentOS默认的源里面软件比较旧,有些软件、库还没有。
EPEL源:
Extra Packages for Enterprise Linux (or EPEL)或者叫企业版 Linux 附加软件包, 是一个由特别兴趣小组创建、维护并管理的,针对 红帽企业版 Linux(RHEL)及其衍生发行版 (比如 CentOS、 Scientific Linux)的一个高质量附加软件包项目。
EPEL 的软件包通常不会与企业版 Linux 官方源中的软件包发生冲突,或者互相替换文件。 EPEL 与 Fedora 项目基本一致,包含完整的构建系统、升级管理器、镜像管理器等等。
EPEL源官方网站:https://fedoraproject.org/wiki/EPEL
添加EPEL源:
32位CentOS,在命令行运行下面命令:
rpm -ivh http://mirrors.ustc.edu.cn/fedora/epel/6/i386/epel-release-6-8.noarch.rpm
64位CentOS,在命令行运行下面命令:
rpm -ivh http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
EPEL源只能作为CentOS官方源的补充,里面还都是一些系统基础的软件包, 我们要安装的php,php-fpm,mysql等软件里面还是没有,所以接下来添加另一个软件源Remi。
Remi源中的软件几乎都是最新稳定版。或许您会怀疑稳定不?放心吧, 这些都是Linux骨灰级的玩家编译好放进源里的,他们对于系统环境和软件编译参数的熟悉程度毋庸置疑。
Remi官方网站:http://rpms.famillecollet.com/
添加Remi源,不管32位还是64位的系统,运行下面命令:
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
Remi源默认是没有启用的,我们来启用Remi源,修改 /etc/yum.repos.d/remi.repo
文件,把文件内的 enabled=0
改为 enabled=1
,注意:改文件内有2个 enabled=0
我们修改[remi]
下面的,不要修改[remi-test]下面的。
到这里yum源的配置结束,下面安装软件就简单了。安装时候有询问y/n的时候都是y
安装php,php-fpm以及php扩展:
yum install php php-fpm php-bcmatch php-gd php-mbstring php-mcrypt php-mysql
安装mysql:
yum install mysql-server
安装nginx:
yum install nginx
OK,一切搞定,下面把所有涉及到的配置文件列一下(下面配置文件默认均已自动创建,不用我们自己创建):
Mysql配置文件my.cnf路径:/etc/my.cnf
Nginx配置文件nginx.conf路径:/etc/nginx/nginx.conf
PHP配置文件php.ini路径: /etc/php.ini
php-fpm配置文件php-fpm.conf路径:/etc/php-fpm.conf

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

If you are an experienced PHP developer, you might have the feeling that you’ve been there and done that already.You have developed a significant number of applications, debugged millions of lines of code, and tweaked a bunch of scripts to achieve op

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.
