Home > Backend Development > PHP Problem > How to install php on linux

How to install php on linux

王林
Release: 2023-02-26 21:48:01
Original
4490 people have browsed it

How to install php on linux

1. Check whether php is installed

1. yum installation check:

yum list installed |grep php
Copy after login

2. rpm installation check:

rpm -qa |grep php
Copy after login

2. Download and install php

1. Use wget to download the tar.gz file of php: wget http://br2.php.net/get/php- 7.2.2.tar.gz

2. Unzip the tar.gz file: tar zxvf php-7.2.2.tar.gz

3. Create a new folder where php will be installed later: mkdir /usr/local/php, and then enter the decompressed PHP installation package folder and configure configure

3. Configure PHP related files

1 , configure php.ini, this is the php configuration file

cp /home/myload/php-7.2.2/php.ini-development    /usr/local/php/lib/php.ini
Copy after login

2, configure php-fpm.conf, this is the php-fpm configuration file

cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
Copy after login

3, configure www.conf, configure User’s file

cp etc/php-fpm.d/www.conf.default  etc/php-fpm.d/www.conf
Copy after login

4. Copy the php-fpm startup file to the init.d folder to facilitate starting php

cp -R sbin/php-fpm /etc/init.d/php-fpm
Copy after login

4. Start PHP

Command:

/etc/init.d/php-fpm
Copy after login

Check whether it is started:

ps -ef |grep php
Copy after login

Recommended tutorial: PHP video tutorial

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

Related labels:
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