Table of Contents
php compilation and installation
Add user
Download and decompress the installation package
Install dependencies
Compile and install
Establish a soft link
Pair php -fpm running user to set up
Configure environment variables and add global commands
Start the php-fpm service
View Whether to start
Kill php-fpm
Home Backend Development PHP Tutorial Compile and install php7.2 on linux

Compile and install php7.2 on linux

Jul 06, 2018 pm 03:20 PM
linux php

This article mainly introduces about linux compilation and installation of php7.2, which has certain reference value. Now I share it with everyone. Friends in need can refer to it

php compilation and installation

Add user

useradd -r -s /sbin/nologin php-fpm
Copy after login

Download and decompress the installation package

cd /data/pkg
wget http://php.net/get/php-7.2.2.tar.gz/from/this/mirror 
mv mirror php-7.2.2.tar.gz
tar zxvf php-7.2.2.tar.gz
cd php-7.2.2
Copy after login

Install dependencies

yum -y install libxml2 libxml2-devel openssl openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel libmcrypt-devel libxslt libicu-devel libxslt-devel
Copy after login

Compile and install

./configure \
--prefix=/usr/local/php-7.2.2 \
--with-mhash \
--with-openssl \
--with-config-file-path=/usr/local/php-7.2.2/etc \
--disable-short-tags \
--enable-fpm \
--with-fpm-user=php-fpm --with-fpm-group=php-fpm \
--enable-xml \
--with-libxml-dir \
--enable-bcmath \
--enable-calendar \
--enable-intl \
--enable-mbstring \
--enable-pcntl \
--enable-shmop \
--enable-soap \
--enable-sockets \
--enable-zip \
--enable-mbregex \
--enable-mysqlnd \
--enable-mysqlnd-compression-support \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-gd \
--enable-ftp \
--with-curl \
--with-xsl \
--with-iconv \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--enable-sysvsem \
--enable-inline-optimization \
--with-xmlrpc \
--with-gettext
make -j 4 && make install
Copy after login
ln -s /usr/local/php-7.2.2/ /usr/local/php
ln -s /usr/local/php/bin/php /usr/local/bin
ln -s /usr/local/php/sbin/php-fpm /usr/local/sbin
Copy after login

Pair php -fpm running user to set up

cd /data/pkg/php-7.2.2
cp ./php.ini-development ./php.ini-production /usr/local/php/etc
cp /usr/local/php/etc/php.ini-development /usr/local/php/etc/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
Copy after login
ln -s /usr/local/php/etc/php.ini /usr/local/etc/
ln -s /usr/local/php/etc/php-fpm.conf /usr/local/etc/
ln -s /usr/local/php/etc/php-fpm.d/www.conf /usr/local/etc/
Copy after login

Configure environment variables and add global commands

vim /etc/profile
PATH=$PATH:/usr/local/php/bin
export PATH
source /etc/profile
Copy after login

Start the php-fpm service

/usr/local/sbin/php-fpm
Copy after login

View Whether to start

netstat -lnt | grep 9000
Copy after login

Kill php-fpm

killall php-fpm
Copy after login

The above is the entire content of this article. I hope it will be helpful to everyone's study. For more related content, please pay attention to the PHP Chinese website!

Related recommendations:

Linux compilation and installation of mysql5.7

Usage of PHP7.2 Data Structures

The above is the detailed content of Compile and install php7.2 on linux. For more information, please follow other related articles on the PHP Chinese website!

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

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian

deepseek web version entrance deepseek official website entrance deepseek web version entrance deepseek official website entrance Feb 19, 2025 pm 04:54 PM

deepseek web version entrance deepseek official website entrance

How to install deepseek How to install deepseek Feb 19, 2025 pm 05:48 PM

How to install deepseek

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

How To Set Up Visual Studio Code (VS Code) for PHP Development

How do you parse and process HTML/XML in PHP? How do you parse and process HTML/XML in PHP? Feb 07, 2025 am 11:57 AM

How do you parse and process HTML/XML in PHP?

PHP Program to Count Vowels in a String PHP Program to Count Vowels in a String Feb 07, 2025 pm 12:12 PM

PHP Program to Count Vowels in a String

BITGet official website installation (2025 beginner's guide) BITGet official website installation (2025 beginner's guide) Feb 21, 2025 pm 08:42 PM

BITGet official website installation (2025 beginner's guide)

Ouyi okx installation package is directly included Ouyi okx installation package is directly included Feb 21, 2025 pm 08:00 PM

Ouyi okx installation package is directly included

See all articles