System: CentOS 5.x
Required Packages: httpd-2.4.9.tar.gz
apr-1.5.0.tar.gz
apr-util-1.5.3.tar.gz
pcre-8.35.tar.gz
1. Install the dependency pack first
The code is as follows |
Copy Code |
Yum-y install gcc gcc-c++ libtool-libs autoconf Freetype-devel GD Libjpeg-devel Libpng-devel libxml2-devel Ncurses-devel zlib-devel zip unzip curl-devel wget crontabs File Bison cmake Patch mlocate Flex diffutils automake make Kernel-devel CPP Readline-devel Openssl-devel vim-minimal Glibc-devel Glib2-devel Bzip2-devel E2fsprogs-devel Libidn-devel Gettext-devel Expat-devel Libcap-devel Libtool-ltdl-devel Pam-devel Pcre-devel Libmcrypt-devel |
2. Compile apache-2.4.9
The code is as follows |
Copy Code |
wget http://mirror.esocc.com/apache//httpd/httpd-2.4.9.tar.gz Tar zxf httpd-2.4.9.tar.gz && CD httpd-2.4.9 ./configure--prefix=/usr/local/apache--enable-so --enable-deflate=shared--enable-ssl=shared--enable-expires=shared --enable-headers=shared--enable-rewrite=shared--enable-static-support--WITH-INCLUDED-APR |
Here comes the first error:
Configure:error:Bundled APR requested but not found at./srclib/. Download and unpack the corresponding APR and Apr-util packages to./srclib/.
Said it was necessary to extract the APR and apr-util into the Apache./srclib/directory.
Solution:
The code is as follows |
Copy Code |
wget http://mirror.esocc.com/apache//apr/apr-1.5.0.tar.gz wget http://mirror.esocc.com/apache//apr/apr-util-1.5.3.tar.gz Tar zxf apr-1.5.0.tar.gz && cp-fr apr-1.5.0./httpd-2.4.9/srclib/apr Tar zxf apr-util-1.5.3.tar.gz && cp-fr apr-util-1.5.3./httpd-2.4.9/srclib/apr-util |
And then rerun./configure--prefix= ...
In the execution of make, report the 2nd error:
Error: ' Pcre_dupnames ' undeclared (the ' the ' this function)
Search on the internet said it is Yum installed PCRE version is too old, do not support the PCRE features such as Pcre_dupnames and Pcre_javascript_compat. OK, I'll go to the next version of the PCRE to compile the installation.
Solution:
The code is as follows |
Copy Code |
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.35.tar.gz Tar zxf pcre-8.35.tar.gz && CD pcre-8.35 ./configure Make && make install
|
Once the compilation is complete, we will compile the httpd-2.4.9 again, and the error won't continue.
3. When the build completes the lamp environment, we will start Apache to check if there is a problem
Since you have not done a soft chain and started the service item, you can start by temporarily using this command:
/usr/local/apache/bin/apachectl start
Error found:
Httpd:syntax error on line 149 Of/usr/local/apache/conf/httpd.conf:cannot load modules/libphp5.so into server:/usr/loc Al/apache/modules/libphp5.so:cannot Restore segment prot after Reloc:permission denied
It is obvious that the selinux of the authority problem, the solution:
The code is as follows |
Copy Code |
Chown-r Apache:apache/usr/local/apache Setenforce 0 Chcon-c-v-r-u system_u-r object_r-t textrel_shlib_t/usr/local/apache/modules/libphp5.so |
Finally start Apache:
/usr/local/apache/bin/apachectl start OK, no problem.
Original from: blog.slogra.com