Today, the company asked to install Apache-2.4.9. During the installation process, I encountered two errors. Now I will record them and share them with you.
System: centos 5.x
Required software 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 package
| The Code is as follows: |
Copy code |
Yum-y install GCC gcc-C ++ libtool-libs Autoconf FreeType-devel gdlibjpeg-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-defined ded-Apr |
The first error is displayed:
Configure: Error: bundled APR requested but not found at./srclib/. Download and unpack the corresponding APR and APR-util packages to./srclib /.
It is necessary to extract APR and APR-util to the./srclib/directory of Apache.
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 |
Then execute./configure -- prefix = .....
When executing make, 2nd errors are reported:
Error: 'pcre _ dupnames' undeclared (first use in this function)
I found that the version of the PCRE installed by yum is too old to support pcre_dupnames and pcre_javascript_compat. Well, I will compile and install the PCRE in the latest version.
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 |
After the compilation, we re-compile the httpd-2.4.9, this will not continue to report the error.
3. After compiling the lamp environment, we need to start Apache to check for any problems.
Because no soft link or service item has been enabled, use this command to start it temporarily:
/Usr/local/Apache/bin/apachectl start
Error reported:
Httpd: syntax error on line 149 of/usr/local/Apache/CONF/httpd. conf: cannot load modules/libphp5.so into server:/usr/local/Apache/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied
Obviously, the SELinux permission problem. 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 is ready, no problem.