How to install php on centos6.8 yum

PHPz
Release: 2023-04-13 09:52:20
Original
439 people have browsed it

CentOS 6.8 is a very popular Linux operating system, and it is a commonly used system among people who need to install PHP. PHP is a server-side scripting language that many websites require to run. In CentOS 6.8, you can install PHP by using yum. This article will introduce how to use yum to install PHP in CentOS 6.8.

Step 1: Make sure yum is installed

Before installing PHP, you need to make sure yum in CentOS 6.8 is installed. Open a terminal and enter the following command to check if yum is installed:

yum --version
Copy after login

If yum is already installed, you will see a message about the yum version. If it is not installed, you can install it with the following command:

sudo yum install -y yum-utils
Copy after login

Step 2: Install PHP

You need to update yum before installing PHP:

sudo yum update
Copy after login

After updating, enter the following Command to install PHP:

sudo yum install -y php
Copy after login

This command will install PHP and related dependency packages. After execution, please wait patiently for some time as the installation process may take some time.

Step 3: Check whether PHP has been installed

After completing the installation, you need to check whether PHP has been installed correctly. You can check it by running the following command:

php -v
Copy after login

After execution, you should see the output of the PHP version, which means that PHP has been successfully installed on CentOS 6.8.

Step 4: Install related extensions

Normally, after installing PHP, you need to install some extensions to meet development needs. For example, if you need to use a MySQL database, then you need to install the php-mysql extension.

You can use the following command to install the php-mysql extension:

sudo yum install -y php-mysql
Copy after login

If you need to use other extensions, just replace the extension name with the name of the extension you need to install. For example, if you need to install the php-gd extension:

sudo yum install -y php-gd
Copy after login

Once completed, you need to restart the Apache server for the changes to take effect:

sudo service httpd restart
````
Copy after login

The above is the detailed content of How to install php on centos6.8 yum. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template