Centos7 source code compile and install the latest version of PHP and Apache 2018/12/12

To write the text so far, the latest version:

apache: 2.4.37, download links:

http://mirrors.shu.edu.cn/apache//httpd/httpd-2.4.37.tar.bz2

PHP: 7.3.0, download links:

http://php.net/get/php-7.3.0.tar.bz2/from/a/mirror

 

Apache:

First, I propose to step on pit operation, to inspect the official document: http://httpd.apache.org/docs/2.4/install.html , Baidu do not see too many answers, relatively speaking, is the official website of the authority, in the manual compile time, you will encounter a lot like this:

Bring 1, apr and apr-util version or installation issues

/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_GetErrorCode'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_SetEntityDeclHandler'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_ParserCreate'
/usr/local/apr-util/lib/libaprutil-1.so: undefined reference to `XML_SetCharacterDataHandler'

Variety not found 

configure: error: APR-util not found .  Please read the documentation.

configure: error: APR not found .  Please read the documentation.

Online access to a lot of information he has said rollback versions of a variety of low and then solve the problem, but in the new version of apache to rollback the old version of the apr, apr-util but more likely not installed on himself in this place according to many online way, stepped pit for a long time, according to the official gave way before success.

First install the three basic dependencies: http://apr.apache.org/ , the official said, the latest version installed,

Download extract three dependencies: 

wget http://mirror.bit.edu.cn/apache//apr/apr-1.6.5.tar.bz2

wget http://mirror.bit.edu.cn/apache//apr/apr-util-1.6.1.tar.bz2

wget http://mirror.bit.edu.cn/apache//apr/apr-iconv-1.2.2.tar.bz2

takes -xjvf  Apr 1.6.5.tar.bz2

takes -xjvf  April-util-1.6.1.tar.bz2

takes -xjvf  apr-iconv-1.2.2.tar.bz

Respectively configure, compile, install 

CD  April-1.6.5

./configure

make&&make install

cd ../apr-util-1.6.1

./configure --with-apr=/usr/local/apr

make&&make install 

cd ../apr-iconv-1.2.2

./configure --with-apr=/usr/local/apr

make&&make install

 After installing dependencies, then, to see the official PHP documentation, http://php.net/manual/zh/install.unix.apache2.php , went straight to start the third step,

cd httpd-2_x_NN
./configure --enable-so
make
make install

No fatal error after successful installation can continue with the installation of PHP,

According to the official PHP tutorial go in this operation is carried out with the use of official centos7 mirror, Gnome basic installation environment, so, during the installation process was mainly prompted missing a libxml2, in case the situation of other not foundxx the next attempt to install dependencies to compile PHP installed.

yum -y install libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel pcre-devel

Press all the way down the document operation should be performed

php-v

The final installation will see a successful outcome.

[root@localhost php-7.3.0]# php -v
PHP 7.3.0 (cli) (built: Dec 12 2018 19:54:37) ( ZTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.0-dev, Copyright (c) 1998-2018 Zend Technologies
 

Published 18 original articles · won praise 8 · views 30000 +

Guess you like

Origin blog.csdn.net/qq_20408397/article/details/84978588