SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot
    Join Date
    Jun 2001
    Location
    Earth
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help needed: cannot include mod_rewrite in Apache build

    Hi.
    I hope somebody can help me with this, because it's really driving me crazy:

    Just for the record: I have Windows 98 on my PC and I have installed on it the Cygwin development environment, under which I'm running Apache.
    The installed version is Apache 1.3.22 and I use it to make local tests and development. Installation was successfull and things worked as expected.
    The problems started when I tried to add the module mod_rewrite: it don't manage to get it compiled and included in the Apache build. Please note that I cheched in the Apache source files and mod_rewrite.c and mod_rewrite.h are present in the modules/standard/ dir.

    Here is what I did:
    1.Changed the src/Configuration.tmpl file by uncommenting the line
    AddModule modules/standard/mod_rewrite.o

    2. ran ./configure in the Apache_1.3.22 directory
    3. make
    4. make install

    I get the message that Apache as been successfully installed, but
    -if I go to the usr/local/apache/bin directory and type
    ./httpd -l
    mod_rewrite.c is not listed, and
    -since I have within a <VirtualHost> tag in the httpd.conf file RewriteEngine on,when I try to start Apache agin I get the message:

    /$ /usr/local/apache/bin/apachectl start
    Syntax error on line 992 of /usr/local/apache/conf/httpd.conf:
    Invalid command 'RewriteEngine', perhaps mis-spelled or defined by
    included in the server configuration
    /usr/local/apache/bin/apachectl start: httpd could not be started


    Can anybody please tell me what I'm doing wrong?
    Is there something else that need to be modified in the configurations files (both Configuration.tmpl and htppd.conf)?
    I tried to edit also Configuration (not Configuration.tmpl) but the result was the same.

    Please help me !
    Thanks in advance!
    cla313

  2. #2
    Are you ready for BSD? Marshall's Avatar
    Join Date
    Dec 2001
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1.Changed the src/Configuration.tmpl file by uncommenting the line
    AddModule modules/standard/mod_rewrite.o
    Does the file `modules/standard/mod_rewrite.o' exist after running `make'?

    Can anybody please tell me what I'm doing wrong?
    Is there something else that need to be modified in the configurations files (both Configuration.tmpl and htppd.conf)?
    Edit `httpd.conf' and check that the `LoadModule' and `AddModule ' lines for mod_rewrite are not commented out. Also verify that the file referenced by the `LoadModule' parameter exists in the location specified.

    I have Windows 98 on my PC and I have installed on it the Cygwin development environment, under which I'm running Apache.
    You do know that there is a native Win32 version of Apache, right? It doesn't come with mod_rewrite compiled by default but you can always compile it yourself.

    - Marshall

  3. #3
    SitePoint Zealot
    Join Date
    Jun 2001
    Location
    Earth
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for your reply Marshal.
    Does the file `modules/standard/mod_rewrite.o' exist after running `make'?
    No! As I said before I only see
    mod_rewrite.c and
    mod_rewrite.h
    in the modules/standard/ directory even after running make.


    Edit `httpd.conf' and check that the `LoadModule' and `AddModule ' lines for mod_rewrite are not commented out.
    AddModule is a line which exists only in my Configuration file for apache and not in the httpd.conf file.
    As for LoadModule I have a commented line in httpd.conf which sounds like this

    # Dynamic Shared Object (DSO) Support
    #
    # To be able to use the functionality of a module which was built as a DSO you
    # have to place corresponding `LoadModule' lines at this location so the
    # directives contained in it are actually available _before_ they are used.
    # Please read the file http://httpd.apache.org/docs/dso.html for more
    # details about the DSO mechanism and run `httpd -l' for the list of already
    # built-in (statically linked and thus always available) modules in your httpd
    # binary.
    #
    # Note: The order in which modules are loaded is important. Don't change
    # the order below without expert advice.
    #
    # Example:
    # LoadModule foo_module libexec/mod_foo.so




    do you mean I have to add here a line like

    # LoadModule mod_rewrite modules/standard/mod_rewrite.o ?

    Do I have to add something like this also:

    <IfModule mod_dir.c>
    rewriteEngine on
    </IfModule>


    And, I repeat , the only thing I changed in the Configuration (not httpd.conf, mind!) file was as I said the AddModule line.

    Can anyone show me examples of httpd.conf and Configuration files which work?

    Marshall, what do you mean by this:
    It doesn't come with mod_rewrite compiled by default but you can always compile it yourself.
    of course I am using a version of apache for win32 and by the way I tried to compile mod_rewrite myself but just got

    $ gcc mod_rewrite.c
    In file included from mod_rewrite.c:93:
    mod_rewrite.h:112: httpd.h: No such file or directory
    mod_rewrite.h:113: http_config.h: No such file or directory
    mod_rewrite.h:114: http_conf_globals.h: No such file or dire
    mod_rewrite.h:115: http_request.h: No such file or directory
    mod_rewrite.h:116: http_core.h: No such file or directory
    mod_rewrite.h:117: http_log.h: No such file or directory
    mod_rewrite.h:118: http_vhost.h: No such file or directory


    I really don't know how to solve this. Please help me!!
    cla313

  4. #4
    SitePoint Zealot
    Join Date
    Jun 2001
    Location
    Earth
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well, here I am again. Still hoping somebody can help me to solve this problem which is really becoming frustrating.

    I finally got the point of the last question from Marshal: I am using Apache for Cygwin and not just Apache for Windows, because I want to work in the closest possible condition to those of the production server (Solaris running Unix).

    Now these are the latest things that I tried, all without success:
    ********first attempt:************
    static linked version of httpd

    $cd apache_1.3.22
    $ ./configure --enable-module=rewrite \
    > --add-module=/var/tmp/apache_1.3.22/src/modules/standard/mod_rewrite.c
    $make
    $make install


    Result: did not work ; when I called
    ./httpd -l
    mod_rewrite was not included and indeed when I started apache it just told me the usual
    Invalid command 'RewriteEngine'...bla...bla (see my first post to this thread)

    *****second attempt******
    or trying to build a dll version of httpd...(shared core dll linked version)
    $cd apache_1.3.22
    $ ./configure --enable-rule=SHARED_CORE \
    >--enable-module=rewrite \
    > --add-module=/var/tmp/apache_1.3.22/src/modules/standard/mod_rewrite.c
    $make


    Here I get this error message:
    [...]mod_rewrite.c:93: mod_rewrite.h: No such file or directory
    make[4]: *** [mod_rewrite.o] Error 1
    make[3]: *** [all] Error 1
    make[2]: *** [subdirs] Error 1
    make[2]: Leaving directory `/var/tmp/apache_1.3.22/src'
    make[1]: *** [build-std] Error 2
    make[1]: Leaving directory `/var/tmp/apache_1.3.22'
    make: *** [build] Error 2


    But mod_rewrite.h is there(in /var/tmp/apache_1.3.22/src/modules/standard/mod_rewrite.h)!!

    ****THird attempt*****
    well I wanted to try the shared dll modules linked option (see http://httpd.apache.org/docs/cygwin.html )
    but then if I read it correctly it says that it won't work on win98!!

    Please help me, this is really making me crazy!!!!
    cla313

  5. #5
    SitePoint Zealot
    Join Date
    Jun 2001
    Location
    Earth
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    problem is solved

    Hi. Today I managed to get mod_rewrite enabled.
    So I just add hereafter what I did, maybe it can be of some help for somebody having the same problem.

    method: static linked version of httpd

    $cd apache_1.3.22
    $ ./configure --enable-module=rewrite \
    > --add-module=/var/tmp/apache_1.3.22/src/modules/standard/mod_rewrite.c

    $make


    At this point I got a an error like this :

    [...]mod_rewrite.c:93: mod_rewrite.h: No such file or directory
    make[4]: *** [mod_rewrite.o] Error 1
    make[3]: *** [all] Error 1
    make[2]: *** [subdirs] Error 1
    make[2]: Leaving directory `/var/tmp/apache_1.3.22/src'
    make[1]: *** [build-std] Error 2
    make[1]: Leaving directory `/var/tmp/apache_1.3.22'
    make: *** [build] Error 2


    Yesterday i did not realize that the -add-module=file option is making a copy of the source file in the directory modules/extra/ and adds on-the-fly an entry for it in the configuration file. mod_rewrite.h was precisely missing in this directory. So I copied mod_rewrite.h from /modules/standard/ to /modules/extra and reran
    $make
    This time there were no errors.
    Then i installed the package:
    $make install

    mod_rewrite is now enabled and working.
    cla313


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •