A simple guide to using Yum to install PHP on Linux
In Linux systems, Yum is a very commonly used package management tool that can help us easily install various software packages . This article will take the CentOS system as an example to introduce how to use Yum to install PHP. The following are specific steps and code examples:
Step 1: Update the system
Before installing any software, you should first update the system to ensure that all software packages in the system are up to date. Enter the following command in the terminal:
sudo yum update
Step 2: Install PHP
Next, we can use Yum to install PHP. Enter the following command in the terminal:
sudo yum install php
If you need to install a specific version of PHP, you can add the version number after the command, for example:
sudo yum install php7.4
Step 3: Install PHP extensions
In addition to installing PHP itself, sometimes you also need to install some PHP extensions to meet specific functional requirements. You can install commonly used PHP extensions through the following commands:
sudo yum install php-mysql php-gd php-xml php-mbstring
Step 4: Check the PHP version
After the installation is complete , you can use the following command to check the PHP version:
php -v
If you see the PHP version information displayed in the output, it means that PHP is installed successfully.
Step 5: Start the PHP service
After the installation is completed, you may need to start the PHP service to run normally. You can use the following command to start the PHP service:
sudo systemctl start php-fpm
Step 6: Set PHP to start automatically after booting
In order to have the PHP service start automatically when the system starts, you can Use the following command to set up auto-start at boot:
sudo systemctl enable php-fpm
Through the above steps, we can use Yum to install PHP and make relevant configurations in the Linux system. Hope this simple guide helps you. If you have any questions or issues, please leave a message for discussion.
The above is the detailed content of A simple guide to installing PHP on Linux using Yum. For more information, please follow other related articles on the PHP Chinese website!