LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-01-2009, 04:10 PM   #1
tekmann33
Member
 
Registered: Nov 2006
Posts: 188

Rep: Reputation: 30
Can't enable mod_rewrite


I am probably forgetting something basic, but can someone show me what I am doing wrong when I try to enable the mod_rewrite module for Apache 2.

This is what I am doing:
(Fedora 10 platform)

The mod_rewrite module seems to already be present in the /lib directory

Code:
[root@localhost modules]# pwd
/usr/lib/httpd/modules
[root@localhost modules]# ls -l mod_rewrite.so 
-rwxr-xr-x 1 root root 59256 2008-10-21 06:53 mod_rewrite.so
[root@localhost modules]#
I configure apache with the 'enable' extension '--enable-rewrite' and then did a 'make' and 'make-install' without any errors.

When I go into the httpd.conf file, I do not see the "LoadModule' line for mod_rewrite. So, I manually put it in. Here is a snippet of httpd.conf:

Code:
LoadModule foo_module modules/mod_foo.so
LoadModule php5_module        modules/libphp5.so
LoadModule mod_rewrite         modules/mod_rewrite.so
#
However, I look over in the apache modules directory, and I don't see it:

Code:
[root@localhost modules]# pwd
/usr/local/apache2/modules
[root@localhost modules]# ls -l
total 12428
-rw-r--r-- 1 root root     9046 2009-02-01 15:13 httpd.exp
-rwxr-xr-x 1 root root 12691378 2009-01-01 22:57 libphp5.so
[root@localhost modules]#
So, I manually copy it over from /usr/lib/httpd/modules:
Code:
[root@localhost modules]# pwd
/usr/local/apache2/modules
[root@localhost modules]# ls -l
total 12492
-rw-r--r-- 1 root root     9046 2009-02-01 15:13 httpd.exp
-rwxr-xr-x 1 root root 12691378 2009-01-01 22:57 libphp5.so
-rwxr-xr-x 1 root root    59256 2009-02-01 15:59 mod_rewrite.so
[root@localhost modules]#
I then restart apache, and I get the following error:

Code:
[root@localhost conf]# /usr/local/apache2/bin/apachectl restart
httpd: Syntax error on line 54 of /usr/local/apache2/conf/httpd.conf: Can't locate API module structure `mod_rewrite' in file /usr/local/apache2/modules/mod_rewrite.so: /usr/local/apache2/modules/mod_rewrite.so: undefined symbol: mod_rewrite
Can someone show me my error or point me to documentation that might explain how to do this?
 
Old 02-01-2009, 04:37 PM   #2
tekmann33
Member
 
Registered: Nov 2006
Posts: 188

Original Poster
Rep: Reputation: 30
I should have added that it looks like the mod_rewrite module is loaded:

Code:
[root@localhost modules]# httpd -M
Loaded Modules:
 core_module (static)
 mpm_prefork_module (static)
 http_module (static)
 so_module (static)
 auth_basic_module (shared)
 auth_digest_module (shared)
 authn_file_module (shared)
 authn_alias_module (shared)
 authn_anon_module (shared)
 authn_dbm_module (shared)
 authn_default_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 authz_owner_module (shared)
 authz_groupfile_module (shared)
 authz_dbm_module (shared)
 authz_default_module (shared)
 ldap_module (shared)
 authnz_ldap_module (shared)
 include_module (shared)
 log_config_module (shared)
 logio_module (shared)
 env_module (shared)
 ext_filter_module (shared)
 mime_magic_module (shared)
 expires_module (shared)
 deflate_module (shared)
 headers_module (shared)
 usertrack_module (shared)
 setenvif_module (shared)
 mime_module (shared)
 dav_module (shared)
 status_module (shared)
 autoindex_module (shared)
 info_module (shared)
 dav_fs_module (shared)
 vhost_alias_module (shared)
 negotiation_module (shared)
 dir_module (shared)
 actions_module (shared)
 speling_module (shared)
 userdir_module (shared)
 alias_module (shared)
 rewrite_module (shared)
 proxy_module (shared)
 proxy_balancer_module (shared)
 proxy_ftp_module (shared)
 proxy_http_module (shared)
 proxy_connect_module (shared)
 cache_module (shared)
 suexec_module (shared)
 disk_cache_module (shared)
 file_cache_module (shared)
 mem_cache_module (shared)
 cgi_module (shared)
 proxy_ajp_module (shared)
Syntax OK
However, even with the 'Load Module' line in httpd.conf, upon restarting apache, I still receive the error:

[root@localhost conf]# /usr/local/apache2/bin/apachectl restart
httpd: Syntax error on line 54 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/mod_rewrite into server: /usr/local/apache2/modules/mod_rewrite: cannot open shared object file: No such file or directory
 
Old 02-01-2009, 04:53 PM   #3
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,159
Blog Entries: 1

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
Quote:
[root@localhost modules]# httpd -M
Loaded Modules:
...
<b>rewrite_module (shared)</b>
...
Syntax OK
I think that you have another apache installed probably with your distro, unless /usr/local/apache2/bin/httpd is in your PATH. The way you configured apache, mod_rewrite is built-in apache, so in the above example is should shown as static, not shared.
And for this reason you don't need the "LoadModule mod_rewrite ..."
The module you've copied is from the other apache installation, that's why you get the "undefined symbol" error.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mod_rewrite delmoras Linux - Newbie 1 01-12-2009 11:16 AM
mod_rewrite basarab1310 Linux - Newbie 1 11-06-2008 07:57 AM
How to enable Apache mod_rewrite, after apache installed without this modue jCash Linux - Newbie 1 10-24-2006 10:23 AM
mod_rewrite mr_dizzle Linux - General 1 02-02-2006 07:32 PM
enable mod_rewrite in apache 1.3.9 robertngo Linux - Software 4 07-18-2005 03:02 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration