Home > Article > Operation and Maintenance > How to use yum to install and build a PHP environment in Linux
1. First, make sure the yum package manager is installed on the system. If yum is not installed on your system, please execute the following command:
sudo apt-get install yum
2. Next, you need to add a yum software source to obtain the PHP package from it. Execute the following command in the terminal:
sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
3. After adding the above software sources, you can use the yum command to install PHP related software packages. Execute the following command to install PHP and its common extensions:
sudo yum install php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml
4. After executing the above command, you need to check whether PHP is installed successfully. Please enter the following command in the terminal to check the PHP version:
php -v
If PHP is installed correctly, the terminal will output the current PHP version number.
5. Next, you need to set up the PHP configuration file. Enter the following command in the terminal to edit the PHP configuration file:
sudo vim /etc/php.ini
In the editor that opens, you can modify various PHP configuration parameters, including maximum memory limit, maximum execution time, etc.
6. After the configuration is completed, you need to restart the Apache service to make it take effect:
sudo systemctl restart httpd
The versions of Linux are: Deepin, UbuntuKylin, Manjaro, LinuxMint , Ubuntu and other versions. Among them, Deepin is one of the best-developed Linux distributions in China; Ubuntu Kylin is a derivative distribution based on Ubuntu; Manjaro is a Linux distribution based on Arch; LinuxMint's default Cinnamon desktop is similar to Windows XP and is simple and easy to use; Ubuntu is a desktop application Mainly Linux operating system.
The above is the detailed content of How to use yum to install and build a PHP environment in Linux. For more information, please follow other related articles on the PHP Chinese website!