Home > Article > Backend Development > How to install PHP via yum and enable FPM mode
1. Background introduction
In Linux systems, yum is one of the main ways to manage and install software packages. PHP is a commonly used Web programming language, and FPM is a PHP operating mode that can improve the performance and stability of the Web server. This article will detail how to install PHP through yum and enable FPM mode.
2. Install PHP with yum
First, the list of software packages that need to be upgraded to the system:
sudo yum update
Use yum to install PHP, you can use the following command:
sudo yum install php
During the installation process, you will be prompted whether to continue. Just enter y and press Enter.
After the installation is completed, you can verify whether PHP is installed correctly by running the following command:
php -version
If the PHP version number is displayed correctly, please indicate PHP has been installed correctly.
3. Enable FPM mode
You can use the following command to install FPM:
sudo yum install php-fpm
During the installation process, there will be Prompt whether to continue. Just enter y and press Enter.
After the installation is complete, you need to edit the PHP FPM configuration file and find the following two settings:
;listen = 127.0.0.1:9000 ;listen = /run/php-fpm/php-fpm.sock
By default, the One line is commented out, the second line is uncommented and set up to listen to the Unix Socket. If you want to use TCP/IP port listening, just uncomment the first line. For example, change the first line to:
listen = 127.0.0.1:9000
After configuring FPM, you need to start FPM to run. Run the following command:
sudo systemctl start php-fpm
Run the following command to view the port FPM is listening on:
sudo netstat -anp | grep php-fpm
If it starts successfully, you should be able to See the port you are listening on.
4. Summary
Using yum to install PHP is a convenient and fast way. Enabling FPM mode can improve the performance and stability of the web server. This article introduces the process from installing PHP to enabling FPM in detail. I hope it will be helpful to readers.
The above is the detailed content of How to install PHP via yum and enable FPM mode. For more information, please follow other related articles on the PHP Chinese website!