lnmp-php7 source installation

Download the corresponding package

https://www.php.net/downloads.php

I use php-7.3.7.tar.gz (https://www.php.net/distributions/php-7.3.6.tar.gz)

Install its dependencies:

yum install -y gcc gcc-c++  make zlib zlib-devel pcre pcre-devel  libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers
yum install -y libXpm  libXpm-devel

Installation Configuration :( configuration instructions may be executed or reference https://www.cnblogs.com/HKUI/p/5137115.html ./configure --help)

./configure \
--prefix=/data1/server/php \
--with-config-file-path=/data1/server/php \
--with-config-file-scan-dir=/data1/server/php/conf/conf.d \
--sysconfdir=/data1/server/php/conf \
--enable-mbstring \
--enable-ftp \
--with-gd \
--with-jpeg-dir \
--with-png-dir \
--with-mysql \
--with-mysqli \
--with-pdo_mysql \
--with-pear \
--with-freetype-dir \
--with-zlib \
--with-libxml-dir \
--with-xmlrpc \
--enable-zip \
--enable-fpm \
--enable-xml \
--enable-sockets \
--with-gd \
--with-zlib \
--with-iconv \
--enable-soap \
--enable-pcntl \
--enable-cli \
--with-curl \
--enable-bcmath \
--enable-calendar \
--enable-exif \
--with-zlib-dir \
--with-bz2 \
--with-mcrypt \
--enable-shmop \
--enable-simplexml \
--with-xpm-dir \
--with-openssl \
--enable-wddx 

Note: Due to PHP7 no longer support mysql, but replaced with mysqli. Thus warning will appear as shown above in FIG. But never mind, mysql if you need to install php extensions.

After compiling, run the installation command: make && make install

Copy code packet from the inside php.ini

cp php.ini-production /data1/server/php/php.ini

Copy the startup script

cp ./sapi/fpm/init.d.php-fpm /data1/server/php/php-fpm

chmod +x /data1/server/php/php-fpm

 

Modify php-fpm configuration file:

cd /data1/server/php/conf/

cp php-fpm.conf.default php-fpm.conf

 vi php-fpm.conf removed foregoing pid = run / php-fpm.pid semicolon


 cd php-fpm.d

cp www.conf.default www.conf

vi www.conf modify user and user group of the current user (or may not change, the default nobody adding users and user groups)

/ Data1 / server / php / php-fpm start # php-fpm start command

/ Data1 / server / php / php-fpm stop # php-fpm stop command

/ Data1 / server / php / php-fpm restart # php-fpm restart command

$ Ps -ef | grep php or ps -A | grep -i php # check whether they have successfully started PHP

 

Add environment variables to php

Modify / etc / profile file so that permanent force, and all users of the system to take effect at the end of file add the following two lines of code
the PATH = $ the PATH: / data1 / Server / PHP / bin
Export the PATH

source / etc / profile to reproduce the load configuration to take effect, echo $ PATH check

 

Source: https: //www.cnblogs.com/kccdzz/p/9106513.html

Guess you like

Origin www.cnblogs.com/chenjunwu/p/10958710.html