想做一个apache2.x模块,就只是用系统自动生成的框架,自己没有加任何代码,编译时出现以下错误:
[Fatal Error] Project1.dpr(6): Unit ApacheTwoApp was compiled with a different version of HTTPD2.MODULE_MAGIC_NUMBER_MAJOR

解决方案 »

  1.   

    楼主!
    清先检查一下,你是否在Delphi7下安装了"IW for Delphi6"?
    或者说:      你是否在Delphi6下安装了"IW for Delphi7"?
    ========================================================
    这样是不行的噢!
      

  2.   

    没有啊,除了Delphi7自带的,我没有安装任何第三方的网络控件
      

  3.   

    As you may know, Delphi 7 ships with 2.0.39 support, and won't work with .40 due to interface changes done by Apache. Here is what you need to change to support .40. Note that I have tested this, and look at the structures in memory (they appear correct; it is easy to see when they are not correct), however, it is untested and is an "unofficial fix". I will try to post it to the borland site when I have time, and an official fix when we can. Thanks, 
    Corbin 
    Borland RAD R&D Engineer 
    --------------------------------------------------------------------------------Open up HTTPD2.pas 
    For Apache 2.0.40, change the following constants: 
      MODULE_MAGIC_NUMBER_MAJOR = 20020628; { Apache 2.0.40 }
      MODULE_MAGIC_NUMBER_MINOR = 0;For Apache 2.0.41 up to 2.0.45, change the following constants: 
      MODULE_MAGIC_NUMBER_MAJOR = 20020903; { Apache 2.0.41..45 }
      MODULE_MAGIC_NUMBER_MINOR = 0;For Apache 2.0.46, change the following constants: 
      MODULE_MAGIC_NUMBER_MAJOR = 20020903; { Apache 2.0.46 }
      MODULE_MAGIC_NUMBER_MINOR = 2; // or 3;For Apache 2.0.47, change the following constants: 
      MODULE_MAGIC_NUMBER_MAJOR = 20020903; { Apache 2.0.47 }
      MODULE_MAGIC_NUMBER_MINOR = 4;
    Before the conn_rec declaration, add: 
      ap_conn_keepalive_e = (AP_CONN_UNKNOWN, AP_CONN_CLOSE, AP_CONN_KEEPALIVE);In the conn_rec structure, replace this: 
        (** Are we still talking? *)
        flags: Cardinal;
        { The following are in the flags bitset:
        unsigned aborted:1;    (** Are we going to keep the connection alive for another request?
         *  -1 fatal error, 0 undecided, 1 yes   *)
        signed int keepalive:2;    (** have we done double-reverse DNS? -1 yes/failure, 0 not yet,
         *  1 yes/success *)
        signed int double_reverse:2;
        }with: 
        (** Are we still talking? *)
        flags1: Cardinal;
        { The following are in the flags bitset:
        unsigned aborted:1; }    (** Are we going to keep the connection alive for another request?
         * @see ap_conn_keepalive_e *)
        keepalive: ap_conn_keepalive_e;    flags2: Cardinal;
        { The following are in the flags bitset:
        (** have we done double-reverse DNS? -1 yes/failure, 0 not yet,
         *  1 yes/success *)
        signed int double_reverse:2;
        }
    --------------------------------------------------------------------------------
    Note that in order to make this patch work with the latest release of Apache (version 2.0.41 or higher), you have to change MODULE_MAGIC_NUMBER_MAJOR to 20020903 (instead of 20020628) to make it work. 
    Before you modify HTTP2D.pas make sure you have a backup of the original file as well - just in case. After you've modified HTTP2D.pas, you have to make sure that this file is "found first" by your web project, which can be done in a number of ways. The safest is to place the new HTTPD2.pas in your project directory itself, so only this project will use the modified VCL file. 
    Alternately - a more dangerous approach - you can rename the HTTPD2.dcu file in the Lib directory (for example to HTTPD2.dcu_) and place the new HTTPD2.pas file in the Lib directory, so Delphi will recompile it when needed. Note that anything you change in the "official" Delphi directory is "dangerous", since official patches from Borland will only patch original untouched files. So I personally always make local copies of modified VCL files (and add them to the project directory only). Update: note that you may also need to recompile the ApacheTwoApp.pas and ApacheTwoHTTP.pas files (because they depend on the changes in HTTP2D.pas). So, you may want to copy these two files the LIB directory and rename their .DCU counterpart to .DCU_ as well. Then, do a Build All (so the new .dcu files are generated). That should work (I just rechecked it on a clean configuration).