Home>Article>Backend Development> How to solve the problem of APR not found when compiling and installing Apache under Linux

How to solve the problem of APR not found when compiling and installing Apache under Linux

little bottle
little bottle forward
2019-04-26 14:01:33 2200browse

This article mainly talks about how to solve the problem of APR not found when compiling and installing Apache under Linux. Interested friends who have certain reference value can learn about it.

After I compiled and installed Nginx, MySQL and PHP (see the previous blog: Detailed tutorial on setting up the LNMP environment), I compiled and installed apache:

cd usrlocalmirror..edu.cnapachehttpdhttpd...configure

At this time it prompted: configure: error: APR not found. Please read the documentation.
This means that the APR dependency is missing, so just install it. You can install it with yum but it is not recommended because the APR version installed by yum may not be enough to support the apache you installed. version, so you still need to compile and install a higher version of APR:

cd /usr/local/src
wget http://archive.apache.org/dist/apr/apr-1.6.3. tar.gz
wget http://archive.apache.org/dist/apr/apr-util-1.6.1.tar.gz

Download the above two installation packages in sequence and decompress them one by one:

tar zxvf apr-1.6.3.tar.gz tar zxvf apr-util-1.6.1.tar.gz
cd/usr/local/src/apr-1.6.3 #安装apr ./configure --prefix=/usr/local/apr make && make install
cd /usr/local/src/apr-util-1.6.1 #安装apr-util ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr make && make install

After all the dependencies are installed, switch to the httpd installation directory again to install apache:

cd usrlocalsrchttpd.make && make install

The installation is successful. If you want to start, stop, and restart apache, you need to use the command:

usrlocalhttpdbinhttpd usrlocalhttpdbinhttpd usrlocalhttpdbinhttpd k restart ##重启

Here I reported an error described in the previous blog when restarting: Detailed tutorial on setting up the LNMP environment:

bind() to 0.0.0.0:80 failed (98: Address already in use)

This is because I installed nginx before and it has occupied port 80 and the running port conflicts.

So I need to modify the port number of httpd and the location of the configuration file. /usr/local/httpd/conf/httpd.conf:

vim /usr/local/httpd/conf/httpd.conf

Search Listen 80 and change it to Listen 8080 (the modified port number can be defined arbitrarily, the range is 0~65535, 0 has no meaning, It can also be understood as 1~65535). Restarting httpd prompts a new error:Could not reliably determine the server's fully qualified domain name,

This is because the ServerName in httpd.conf has not been modified. Search for ServerName and change it to: ServerName localhost:8080. After restarting the error disappears, check the running services:

ps: The above installation The dependency version is not fixed. When installing, it is best to read the documentation on the official website and choose an advanced version, such as the apr-1.3.* version, which is used to compile and install httpd-2.4.* apache. Cannot compile

Related tutorials:

PHP video tutorial

Linux video tutorial

The above is the detailed content of How to solve the problem of APR not found when compiling and installing Apache under Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete