Using APXS compilation to add Apache modules under Windows environment

Source: Internet
Author: User

Windowsuse in the environmentApxsCompile AddApacheModule


Description: This article uses the Mod_limitipconn module as an example.

Environment:

windows7x86 System

apache2.4.18

Goal:

In the Windows Environment, use mod_limitipconn0.24 source code,apxs for apache2.4.18 add mod_limitipconn module.

Analysis:

LimitipconnThe latest version of the module has been supportedapache2.4The But there is no compiled version of the corresponding. So you need to compile the module yourself. InWindowsTo achieve this goal, you need to install the following software:Apxs(WindowsVersion),Perl(WindowsVersion of this is to be able to installApxs)、vc++6.0(To install the version.) This isApxsCompileCThe source code module is used by calls. Other software is also available).


Apxs

http://www.apachelounge.com/download/additional/

Perl (ActivePerl)

Http://www.activestate.com/activeperl/downloads

vc++6.0

To install the version. There was an error compiling the green version.


Steps:


install perl (< Span lang= "en-us" xml:lang= "en-US" >activeperl ), the direct default installation is good. Installation completed please confirm windows environment variable path added The text location of the Perl . Not automatically added, please append manually.

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M02/8D/B3/wKioL1imu7GCLPBvAAdhiJHweqc543.png-wh_500x0-wm_ 3-wmp_4-s_2534098524.png "title=" 1.png "alt=" Wkiol1imu7gclpbvaadhijhweqc543.png-wh_50 "/>

Installationvc++6.0, this must use the installation version, or the compilation will be error. My installation directory:D:\ProgramFiles\Microsoft Visual Studio,Confirmation of installation CompletionD:\ProgramFiles\Microsoft Visualstudio\vc98\bin\cl.exe,Double-click whether to error. (if error, please fix it according to the error message.) My error:Mspdb60.dllFile is missing, download the file and drop it intocl.exedirectory). and put "D:\ProgramFiles\Microsoft Visual studio\vc98\bin\ "Add to environment variablePathIn

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M00/8D/B3/wKioL1imu92yMtPPAAdhgP2YRzQ981.png-wh_500x0-wm_ 3-wmp_4-s_1476795905.png "title=" 2.png "alt=" Wkiol1imu92ymtppaadhgp2yrzq981.png-wh_50 "/>

Install APXS:

First Description:Apache installation directory:D:\wamp\bin\apache\apache2.4.18\

Run Windows command Prompt (that is, cmd) and go to the location where the apxs installation package files are located. Run the following command: "perlconfigure.pl--with-apache2=d:\wamp\bin\apache\apache2.4.18--with-apache-prog=httpd.exe".

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M00/8D/B6/wKiom1imvALhrOn7AAAyCVDAo24342.png-wh_500x0-wm_ 3-wmp_4-s_2587415461.png "title=" 3.png "alt=" Wkiom1imvalhron7aaaycvdao24342.png-wh_50 "/>

Note: D:\wamp\bin\apache\apache2.4.18\build\config_vars.mk files and D:\wamp\bin\apache\apache2.4.18\bin\ are generated Apxs.bat file.

To modify the D:\wamp\bin\apache\apache2.4.18\build\config_vars.mk, the effect is as follows:

CC = CL

LD = link

CPP = Cl-nologo-e

Ldflags =kernel32.lib ws2_32.lib apr-1.lib aprutil-1.lib libapr-1.liblibapriconv-1.lib libaprutil-1.lib libhttpd.lib Mod_dav.lib xml.lib/nologo/subsystem:windows/dll/machine:i386/libpath: "D:\wamp\bin\apache\apache~1.18\lib"


Note:CL、Linkis calledD:\ProgramFiles\Microsoft visualstudio\vc98\bin\Under thecl.exe、Link.exe。 whichldflags= ... "d:\wamp\bin\apache\apache~1.18\lib"With the default, you can (" d:\wamp\bin\apache\apache~1.18\lib"Is my default. is actuallyApacheUnder the installation directoryLibDirectory of the folder). IfLdflagsAn error occurs when the project does not change the compilation module.


At the command prompt, run "VCVARS32",

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M01/8D/B6/wKiom1imvCXCpsIhAAA2AcG9wWc927.png-wh_500x0-wm_ 3-wmp_4-s_1037257986.png "title=" 4.png "alt=" Wkiom1imvcxcpsihaaa2acg9wwc927.png-wh_50 "/>

In the Windows environment variable, path, append D:\wamp\bin\apache\apache2.4.18\bin\,

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M00/8D/B3/wKioL1imvF7y5eA7AAi_AB2FW8I312.png-wh_500x0-wm_ 3-wmp_4-s_2495511821.png "title=" 5.png "alt=" Wkiol1imvf7y5ea7aai_ab2fw8i312.png-wh_50 "/>

At the command prompt, enter the directory where the mod_limipiconn source code is located and run the following command:

Apxs-i-C-AMOD_LIMITIPCONN.C

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M01/8D/B3/wKioL1imvIfyd2Y0AABSlhkqWaY931.png-wh_500x0-wm_ 3-wmp_4-s_2594398008.png "title=" 6.png "alt=" Wkiol1imvifyd2y0aabslhkqway931.png-wh_50 "/>


Important NOTES:

The mod_limitipconn.lib file is generated in D:\wamp\bin\apache\apache2.4.18\lib\ .

The mod_limitipconn.so file is generated in D:\wamp\bin\apache\apache2.4.18\modules\ .

Each time you append the contents of the Windows environment variable path , you need to rerun the command prompt to take effect (or to apply it at the command prompt).

Compile-time prompt for "windows.h" related errors, please check the ldflags in the D:\wamp\bin\apache\apache2.4.18\build\config_vars.mk file if it has been modified, please use the vc++6.0of the installation version.


The file locations involved are listed below:

apache2.4.18 Installation location:D:\wamp\bin\apache\apache2.4.18,

vc++6.0 Installation location:D:\ProgramFiles\Microsoft Visual Studio

cl.exe,link.exe and Vcvars32.bat are here:D:\ProgramFiles\Microsoft Visual Studio\vc98\bin \

APXS location after installation:D:\wamp\bin\apache\apache2.4.18\bin\

config_vars.mk Location:D:\wamp\bin\apache\apache2.4.18\build\config_vars.mk

perl Installation location:C:\Perl\

mod_limitipconn Source location:D:\mod_limitipconn\


Add Apache modules using APXS compilation under Windows environment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.