Apache编译

编译环境:

平台:        windows XP

编译工具:    Microsoft VC6.0

Apache 版本: 2.2.15

下载地址:    http://labs.renren.com/apache-mirror/httpd/httpd-2.2.15-win32-src-r2.zip

 

1,下载httpd-2.2.15-win32-src-r2.zip,解压到指定目录.

2,用VC6.0打开Apache.dsw,设置BuildBin Project为Active Project.

3,解决编译中出现的错误:

1)错误提示:

    ./include/apr_ldap.h(136) : fatal error C1189: #error :  Support for LDAP v2.0 toolkits has been removed from apr-util. Please use an LDAP v3.0 toolkit.

  解决方法:

    ./include/apr_ldap.h(136),注释error :  Support for LDAP v2.0 toolkits has been removed from apr-util. Please use an LDAP v3.0 toolkit.

2)错误提示:

    httpd-2.2.15/srclib/apr-util/dbd/apr_dbd_odbc.c(134) : error C2061: syntax error : identifier 'SQLLEN'

  解决方法:

    在该文件中添加 typedef INT32 SQLLEN;

3)错误提示:

   /httpd-2.2.15/srclib/apr-util/dbd/apr_dbd_odbc.c(505) : error C2065: 'SQLULEN' : undeclared identifier

  解决方法:

    在该文件中添加 typedef UINT32 SQLULEN;

4)错误提示:

    /httpd-2.2.15/srclib/apr-util/ldap/apr_ldap_init.c(194) : error C2146: syntax error : missing ';' before identifier 'LDAP_VENDOR_NAME'

    /httpd-2.2.15/srclib/apr-util/ldap/apr_ldap_init.c(195) : error C2065: 'LDAP_VENDOR_NAME' : undeclared identifier

    /httpd-2.2.15/srclib/apr-util/ldap/apr_ldap_init.c(195) : error C2143: syntax error : missing ';' before 'string'

  解决方法:

    注释LDAP_VENDOR_NAME;

4,安装:

  1),设置为InstallBin files为Active Project.

  2),设置安装路径,否则默认为源码的根目录.

     INSTDIR="/Apache22"

     /Apache22/bin/httpd.exe

  3),修改配置文件

     若80端口已被占用,则设置Listen 80为Listen 8080.

5,相关指令

  httpd -k install

  httpd -k install -n "服务名"

  httpd -k install -n "服务名" -f "c:/files/my.conf"

  httpd -k uninstall

  httpd -k uninstall -n "服务名"

  httpd -n "服务名" -t

  httpd -k start

  httpd -k stop

  httpd -k shutdown

  httpd -k restart