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
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
Step 2: Install PHP
You need to update yum before installing PHP:
sudo yum update
After updating, enter the following Command to install PHP:
sudo yum install -y php
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
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
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
Once completed, you need to restart the Apache server for the changes to take effect:
sudo service httpd restart ````
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!