LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 12-02-2011, 10:23 AM   #1
Xris718
Member
 
Registered: May 2003
Location: NYC
Distribution: CentOS
Posts: 261

Rep: Reputation: 30
mod_rewrite in apache


Hi

I have an installed apache2 on the system but its missing mod_rewrite module. Does anyone know how to install it into an already running apache server? I know you can dynamically link it into apache using apxs but I dont have mod_rewrite.c file to compile it from. So I'm stuck.

bash-3.00# ./apachectl -V
Server version: Apache/2.0.59
Server built: Apr 17 2007 11:02:44
Server's Module Magic Number: 20020903:12
Server loaded: APR 0.9.12, APR-UTIL 0.9.12
Compiled using: APR 0.9.12, APR-UTIL 0.9.12
Architecture: 32-bit
Server compiled with....
-D APACHE_MPM_DIR="server/mpm/prefork"
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP
-D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
-D APR_USE_FCNTL_SERIALIZE
-D APR_USE_PTHREAD_SERIALIZE
-D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
-D APR_HAS_OTHER_CHILD
-D AP_HAVE_RELIABLE_PIPED_LOGS
-D HTTPD_ROOT="/usr/local/apache2"
-D SUEXEC_BIN="/usr/local/apache2/bin/suexec"
-D DEFAULT_PIDLOG="logs/httpd.pid"
-D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
-D DEFAULT_LOCKFILE="logs/accept.lock"
-D DEFAULT_ERRORLOG="logs/error_log"
-D AP_TYPES_CONFIG_FILE="conf/mime.types"
-D SERVER_CONFIG_FILE="conf/httpd.conf"


bash-3.00# ./httpd -l
Compiled in modules:
core.c
mod_access.c
mod_auth.c
mod_include.c
mod_log_config.c
mod_env.c
mod_setenvif.c
mod_ssl.c
prefork.c
http_core.c
mod_mime.c
mod_status.c
mod_autoindex.c
mod_asis.c
mod_cgi.c
mod_negotiation.c
mod_dir.c
mod_imap.c
mod_actions.c
mod_userdir.c
mod_alias.c
mod_so.c
 
Old 12-02-2011, 03:50 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

Quote:
I have an installed apache2 on the system but its missing mod_rewrite module. Does anyone know how to install it into an already running apache server? I know you can dynamically link it into apache using apxs but I dont have mod_rewrite.c file to compile it from. So I'm stuck.
From:
Quote:
-D HTTPD_ROOT="/usr/local/apache2"
apache was compiled from source using the default directory /usr/local/apache2.
If you can't find the sources used to compile the running apache, you can download again the source tarball for the same version of apache (2.0.59), extract it in some place, go into httpd-2.0.59/modules/mappers directory and run
Code:
/usr/local/apache2/bin/apxs -a -i -c mod_rewrite.c
This will compile, install and activate the mod_rewrite module, so you have to restart apache to start using it

Regards
 
Old 12-02-2011, 04:08 PM   #3
Xris718
Member
 
Registered: May 2003
Location: NYC
Distribution: CentOS
Posts: 261

Original Poster
Rep: Reputation: 30
Thanks for the tip Bathory I did what you suggested and looks like apxs did in fact compile the mod_rewrite.c but from the looks of this output and the files it generated I cant see or find where the mod_rewrite.so resides. I did a search on the system and no luck either.


bash-3.00# pwd
/var/tmp/ym/httpd-2.0.59/modules/mappers

bash-3.00# apxs -c mod_rewrite.c
/usr/local/apache2/build/libtool --silent --mode=compile gcc -prefer-pic -DAP_HAVE_DESIGNATED_INITIALIZER -DSOLARIS2=9 -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT -g -O2 -pthreads -I/usr/local/apache2/include -I/usr/local/apache2/include -I/usr/local/apache2/include -I/usr/local/include -c -o mod_rewrite.lo mod_rewrite.c && touch mod_rewrite.slo
/usr/local/apache2/build/libtool --silent --mode=link gcc -o mod_rewrite.la -rpath /usr/local/apache2/modules -module -avoid-version mod_rewrite.lo

It did generate these 4 files but I dont know what they are.

-rw-r--r-- 1 root root 167668 Dec 2 17:00 mod_rewrite.o
-rw-r--r-- 1 root root 324 Dec 2 17:00 mod_rewrite.lo
-rw-r--r-- 1 root root 0 Dec 2 17:00 mod_rewrite.slo
-rw-r--r-- 1 root root 822 Dec 2 17:00 mod_rewrite.la

bash-3.00# apxs -i -a mod_rewrite.c
apxs:Error: file mod_rewrite.c is not a shared object.
 
Old 12-02-2011, 05:05 PM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
bash-3.00# apxs -c mod_rewrite.c
Why didn't you use -i and -a options to also install and activate the module?
Anyway, you have to run:
Code:
/usr/local/apache2/apxs -i -a mod_rewrite.la
to complete installation

Regards

Last edited by bathory; 12-02-2011 at 05:07 PM.
 
Old 12-02-2011, 05:51 PM   #5
Xris718
Member
 
Registered: May 2003
Location: NYC
Distribution: CentOS
Posts: 261

Original Poster
Rep: Reputation: 30
You are correct when I re-ran apxs with addition options it did the trick and created mod_rewrite.so in appropriate directory and it also updated httpd.conf file.

/usr/local/apache2/apxs -i -a -c mod_rewrite.c

Thanks again for the help!
 
Old 12-03-2011, 03:20 PM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
You're welcome.
Please use the "Thread tools" to mark the thread Solved

Regards
 
  


Reply



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 and Apache saifurab Linux - Server 3 09-04-2010 08:08 AM
Apache and mod_rewrite Elguapo Linux - Software 1 08-09-2007 03:24 AM
How to enable Apache mod_rewrite, after apache installed without this modue jCash Linux - Newbie 1 10-24-2006 10:23 AM
Apache Mod_rewrite help! soulsniper Linux - Software 0 01-16-2005 05:23 PM
Apache:mod_rewrite MadMikie Linux - Software 0 08-03-2004 07:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:07 PM.

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