centos8 installation php7.4

First, download php7.4

1, the official website:

https://www.php.net/

2. Download

[root@yjweb source]# wget https://www.php.net/distributions/php-7.4.2.tar.gz

Description: When you install the software on linux to compile way, most people are used to install the software under / usr / local directory,

We use two directories in a production environment habits:

/ Usr / local / source save source / rpm installation package

/ Usr / local / soft save software installation 

 

The reason for this distinction is that time in order to download the source code or installation package also save a copy,

A time to be able to understand the version used

And secondly, if there is no need to go to the official website of each software need to be recompiled when to look for historical versions

 

Description: architecture forests is a focus on architecture blog, address: https://www.cnblogs.com/architectforest

         The corresponding source code can be accessed here for:  https://github.com/liuhongdi/

 Description: Author: Liu association E-mail: [email protected]

 

Second, view the local version of centos

[root@localhost lib]# cat /etc/redhat-release 
CentOS Linux release 8.1.1911 (Core) 

 

Third, unpack and configure

1, extract command and configure command

[to set a root @ yjweb source] # tar zxvf php 7.4 . 2 . tar gz
[root@yjweb source]# cd php-7.4.2/
[root@yjweb php-7.4.2]# ./configure --prefix=/usr/local/soft/php7 --with-curl --with-freetype --enable-gd --with-jpeg --with-gettext --with-iconv-dir=/usr/local --with-kerberos --with-libdir=lib64 --with-libxml --with-mysqli --with-openssl --with-pdo-mysql --with-pdo-sqlite --with-pear --enable-sockets --with-mhash --with-ldap-sasl --with-xmlrpc --with-xsl --with-zlib --enable-fpm --enable-bcmath --enable-inline-optimization --enable-mbregex --enable-mbstring --enable-opcache --enable-pcntl --enable-shmop --enable-soap --enable-sockets --enable-sysvsem --enable-xml --with-zip --with-config-file-path=/usr/local/soft/php7/etc -with-bz2 --enable-inline-optimization --enable-sysvsem 

Description: The above parameters configure command php-7.4.2 is available parameters,

         Some older unavailable parameters will prompt you when configure,

        Please do not use the obsolete parameters, to avoid not work properly after the installation is complete

 

2, the installation command:

[root@yjweb php-7.4.2]# make && make install

 

Fourth, the various configuration error encountered during the processing of information

1,报错:Package 'libxml-2.0', required by 'virtual:world', not found

    solve:

[root@localhost php-7.4.2]# yum install libxml2-devel

 

2,报错:Package 'krb5', required by 'virtual:world', not found

   solve:

[root@localhost php-7.4.2]# yum install krb5-devel

 

3,报错:Package 'openssl', required by 'virtual:world', not found

   solve:

[root@localhost php-7.4.2]# yum install openssl-devel

 

4,报错:Package 'sqlite3', required by 'virtual:world', not found

   solve:

[root@localhost php-7.4.2]# yum install sqlite-devel

 

5,报错:Package 'libcurl', required by 'virtual:world', not found

   solve:

[root@localhost php-7.4.2]# yum install libcurl-devel

 

6,报错:Package 'oniguruma', required by 'virtual:world', not found

   solve:

See also: the CentOS . 8 mounted Oniguruma oniguruma-devel and a text 
address: https: //www.cnblogs.com/architectforest/p/12433640.html

 

7,报错:Package 'libxslt', required by 'virtual:world', not found

   solve:

[root@localhost php-7.4.2]# yum install libxslt-devel

 

8,报错:Package 'libjpeg', required by 'virtual:world', not found

   solve:

[root@localhost php-7.4.2]# yum install libjpeg-devel

 

9,报错:Package 'libzip', required by 'virtual:world', not found

   solve:

[root@localhost php-7.4.2]# yum install libzip-devel

 

10,报错:configure: error: Please reinstall the BZip2 distribution

   solve:

[root@yjweb php-7.4.2]# yum -y install bzip2-devel

 

11,报错:Package 'libpng', required by 'virtual:world', not found

   solve:

[root@yjweb php-7.4.2]# yum install libpng-devel

 

12,报错:Package 'freetype2', required by 'virtual:world', not found

   solve:

[root@yjweb php-7.4.2]# yum install freetype-devel

 

V. generate php configuration file

[root@yjweb php-7.4.2]# cp php.ini-production /usr/local/soft/php7/etc/php.ini

 

Sixth, the configuration file is generated www

[root@yjweb etc]# cd /usr/local/soft/php7/etc/php-fpm.d/
[root@yjweb php-fpm.d]# cp www.conf.default www.conf

 

Seven generate php-fpm profile

[root@yjweb etc]# cd /usr/local/soft/php7/etc
[root@yjweb etc]# cp php-fpm.conf.default php-fpm.conf

 

Eight generate php-fpm service startup files

[root@yjweb etc]# mkdir /usr/local/soft/php7/daemon
[root@yjweb etc]# cp /usr/local/source/php-7.4.2/sapi/fpm/init.d.php-fpm /usr/local/soft/php7/daemon/php-fpm
[root@yjweb etc]# chmod 740 /usr/local/soft/php7/daemon/php-fpm

 

IX test launch php-fpm

[root@yjweb etc]# /usr/local/soft/php7/daemon/php-fpm start
Starting php-fpm  done

[root@yjweb etc]# ps auxfww | grep php | grep -v grep root 30476 0.0 0.0 141260 10948 ? Ss 11:40 0:00 php-fpm: master process (/usr/local/soft/php7/etc/php-fpm.conf) nobody 30477 0.0 0.0 167012 10404 ? S 11:40 0:00 \_ php-fpm: pool www nobody 30478 0.0 0.0 167012 10404 ? S 11:40 0:00 \_ php-fpm: pool www

 

Ten, how to check the version of currently installed php?

[root@yjweb etc]# /usr/local/soft/php7/bin/php -v
PHP 7.4.2 (cli) (built: Mar  5 2020 11:16:38) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies

 

XI, see the local version of centos

[sysop@yjweb ~]$ cat /etc/redhat-release
CentOS Linux release 8.0.1905 (Core) 

 

Guess you like

Origin www.cnblogs.com/architectforest/p/12433541.html