Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
Hi, I'm a noob and need your help to fix a problem I'm having with mod_rewrite in Red Hat. I installed Apache, PHP and MySQL following the usual steps found ...
  1. #1
    Just Joined!
    Join Date
    Nov 2011
    Posts
    5

    Problems with Apache mod_rewrite

    Hi, I'm a noob and need your help to fix a problem I'm having with mod_rewrite in Red Hat.

    I installed Apache, PHP and MySQL following the usual steps found in many sites.

    After the installation I got a 500 error, and after checking the usr/local/apache2/logs/error_log I've seen that I have an error message because of a RewriteRule command. I guessed it was due to the mod_rewrite module, which was not installed.

    So prior to adding the LoadModule line, I searched for the mod_rewrite module, but to my surprise, it's not anywhere in the system.

    I've tried recompiling again (I didn't forget the --enable-module=rewrite prefix), but no way. The module is not anywhere.

    So I've finally tested without mod_rewrite and its commands, and now Apache works and responds to an http request, but it does nothing more than send the 200 OK status code and a blank page.

    Any help would be greatly appreciated.

  2. #2
    Linux Enthusiast scathefire's Avatar
    Join Date
    Jan 2010
    Location
    Western Kentucky
    Posts
    616
    mod_rewrite should be installed. Perhaps you need a:
    Code:
    <IfModule mod_rewrite.c>
    in your httpd.conf file.

    Otherwise:
    Code:
    RewriteEngine On
    Should do it. For further info on mod_rewrite, see the apache docs. mod_rewrite - Apache HTTP Server
    linux user # 503963

  3. #3
    Just Joined!
    Join Date
    Nov 2011
    Posts
    5
    I tried with RewriteEngine On too, and it provoked an internal error. Wrapping it with the <IfModule> tags prevented the error to raise, but... I can't find the module file anywhere, and I need it.

  4. #4
    Just Joined!
    Join Date
    Apr 2010
    Posts
    69
    <IfModule...> simply says if the module is loaded, then perform whatever is between the tags. That way, if the module is not loaded (as is your case), the server will run without error assuming all relevant configuration directives related to the module are within the opening and closing IfModule tags. That is why your error goes away with that tag. Based on your original post, I think you passed the wrong flag to ./configure. I believe you should have passed either --enable-rewrite, which would have built the module into httpd statically, or --enable-rewrite=shared, which would have built a loadable dynamically shared object file called mod_rewrite.so in the configured modules directory that you could reference in a loadmodule directive.

    N

  5. #5
    Linux Enthusiast Mudgen's Avatar
    Join Date
    Feb 2007
    Location
    Virginia
    Posts
    623
    I'm wondering why you're compiling Apache instead of installing the httpd rpm. I hate working on such systems, stuff isn't where I expect it to be, have to customize any log management scripts, etc. But I suppose that if you're used to /usr/local/apache2, the other model is alien.

    The Red Hat repo rpm comes with the dynamic mod_rewrite.so.

  6. #6
    Just Joined!
    Join Date
    Nov 2011
    Posts
    5
    I tried again with

    --enable-rewrite=shared

    and now the module is there in the modules dir. However the problem was still going on.

    I realized it was a problem with the installation of PHP or MySQL. After a bit of testing with echoes, I checked that any echo made in my app just after it began dealing with databases was not being sent to the output. So it apparently doesn't have any connection to MySQL??. No error message is displayed even though I specified to display all the errors, just a blank page.

    I used --with-mysql when I compiled PHP.

    @Mudgen:
    Excuse my ignorance, I know very little about Linux, but how could I do that type of installation: httpd rpm? If this way I'm able to have it all installed at once (Apache + PHP + MySQL), and it is not a LAMP distro, which are aimed only at development servers, that's what I want.

  7. #7
    Linux Enthusiast Mudgen's Avatar
    Join Date
    Feb 2007
    Location
    Virginia
    Posts
    623
    Quote Originally Posted by luismartin View Post
    @Mudgen:
    Excuse my ignorance, I know very little about Linux, but how could I do that type of installation: httpd rpm? If this way I'm able to have it all installed at once (Apache + PHP + MySQL), and it is not a LAMP distro, which are aimed only at development servers, that's what I want.
    Oh, sorry. You'll need to familiarize yourself with package management to be successful in the long term. "yum" is the core package management facility in Red Hat/Fedora. Which are you running? If Red Hat, you'll need a current subscription entitlement to pull yum updates, and you'll probably want to enable the EPEL repository as well (google epel).

    When you have yum working, as root or via sudo:
    yum install httpd mysql mysql-libs mysql-server php php-cli php-common php-mysql

    You may need some other packages as well. And you're going to have to do some setup of mysql.

  8. #8
    Just Joined!
    Join Date
    Nov 2011
    Posts
    5
    I'm not subscribed to Red Hat services, so I guess I will have to do it manually right?

  9. #9
    Linux Enthusiast Mudgen's Avatar
    Join Date
    Feb 2007
    Location
    Virginia
    Posts
    623
    I'd suggest that you back up and reinstall with CentOS or Scientific Linux. Red Hat without a subscription is really hard to maintain. You can google around and find rpms and install them, but the yum package manager handles dependencies, making it far simpler.

  10. #10
    Just Joined!
    Join Date
    Nov 2011
    Posts
    5
    Well... the technicians of the company I work for (who are only used to Windows by the way, hence my question here) told me the company is going to renew the old subscription to Red Hat. I'm not sure when though.

    Anyway, I got tired of the difficulties, and I finally opted to download XAMPP for Linux to start working with it as a development server. I know it is not secure to use it for production, but I read it has some command "secure" or something which tweaks the settings in order to set it much more secure.

    What do you think about this?


    P.S: I'm only a web developer, and I'm doing the computer technicians's job which is to set up the server properly, among other things like network admin and computer repairs. I feel a bit frustrated about this. Don't know why I'm telling this

Page 1 of 2 1 2 LastLast

Posting Permissions

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