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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

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 is used to build dynamic websites, and its core functions include: 1. Generate dynamic content and generate web pages in real time by connecting with the database; 2. Process user interaction and form submissions, verify inputs and respond to operations; 3. Manage sessions and user authentication to provide a personalized experience; 4. Optimize performance and follow best practices to improve website efficiency and security.

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.

Improve HDFS performance on CentOS: A comprehensive optimization guide to optimize HDFS (Hadoop distributed file system) on CentOS requires comprehensive consideration of hardware, system configuration and network settings. This article provides a series of optimization strategies to help you improve HDFS performance. 1. Hardware upgrade and selection resource expansion: Increase the CPU, memory and storage capacity of the server as much as possible. High-performance hardware: adopts high-performance network cards and switches to improve network throughput. 2. System configuration fine-tuning kernel parameter adjustment: Modify /etc/sysctl.conf file to optimize kernel parameters such as TCP connection number, file handle number and memory management. For example, adjust TCP connection status and buffer size

The core benefits of PHP include ease of learning, strong web development support, rich libraries and frameworks, high performance and scalability, cross-platform compatibility, and cost-effectiveness. 1) Easy to learn and use, suitable for beginners; 2) Good integration with web servers and supports multiple databases; 3) Have powerful frameworks such as Laravel; 4) High performance can be achieved through optimization; 5) Support multiple operating systems; 6) Open source to reduce development costs.

PHP uses MySQLi and PDO extensions to interact in database operations and server-side logic processing, and processes server-side logic through functions such as session management. 1) Use MySQLi or PDO to connect to the database and execute SQL queries. 2) Handle HTTP requests and user status through session management and other functions. 3) Use transactions to ensure the atomicity of database operations. 4) Prevent SQL injection, use exception handling and closing connections for debugging. 5) Optimize performance through indexing and cache, write highly readable code and perform error handling.

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

The CentOS shutdown command is shutdown, and the syntax is shutdown [Options] Time [Information]. Options include: -h Stop the system immediately; -P Turn off the power after shutdown; -r restart; -t Waiting time. Times can be specified as immediate (now), minutes ( minutes), or a specific time (hh:mm). Added information can be displayed in system messages.
