Compile and install php7.2 on linux

藏色散人
Release: 2019-08-15 14:52:41
forward
3422 people have browsed it

The following will introduce Linux compilation and installation of php7.2. I hope it will be helpful to friends who need it. For more Linux usage tutorials, you can directly visit Linux Video Tutorial to learn!

php compile and install

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

Installation 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

Establish a soft link

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

Set the php-fpm running user

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

Establish a soft link

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 Command

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

Check whether it is started

netstat -lnt | grep 9000
Copy after login

Kill php-fpm

killall php-fpm
Copy after login

or

ps aux | grep php
![clipboard.png](/img/bVbi8rC)
kill -USR2 29261
Copy after login

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!

Related labels:
source:segmentfault.com
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