Find the answer to your Linux question:
Results 1 to 7 of 7
Hi Everyone, A little background on my problem: We have a webserver running with centOS 4.7 and apache 2.2. It runs several virtual hosts, and was set up by a ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2012
    Posts
    3

    Apache httpd service won't start


    Hi Everyone,

    A little background on my problem:
    We have a webserver running with centOS 4.7 and apache 2.2. It runs several virtual hosts, and was set up by a former colleague. Apache is installed in a mounted drive called /wwwroot

    This webserver has now fallen under my control, and although I have some knowledge of linux systems, I'm still quite a newbie. The server has been running happily for months, but now the need has come up for me to add a new website to the server.

    Now the problem:

    I made a change to the httpd.conf file adding a new virtual host, a duplicate of the 6 other servers in the file (obviously changing the paths and servername), saved the file and restarted the httpd service. But the httpd service didn't restart, it fails claiming it can't find the httpd.conf file in the default location (/etc/httpd/), which is right, because the file isn't there and looks like it never has been, and I wouldn't expect it to be as Apache is installed in /wwwroot.
    Hence my question, why is it suddenly looking there for the file? In the last week of messing about I've even come to realise that the conf file I changed may well not have even been the live file (he seems to have at least a dozen different versions of the file scattered over /wwwroot and /root folders). But either way I didn't change any paths to config files so I don't understand why it is now looking for files that have never been there.

    I just tried running httpd -f /wwwroot/apache/conf/httpd.conf to force it to use that file and I get:

    Syntax error on line 54 of /wwwroot/apache/conf/httpd.conf:
    API module structure `authn_file_module' in file /wwwroot/apache/modules/mod_authn_file.so is garbled - perhaps this is not an Apache module DSO?


    I tried running the make install (using the same config I presume he used) again, but still same problem.

    Any ideas how to make this work now?

    I know it's difficult without knowing the exact setup, but any help would be appreciated. I've enjoyed tinkering with it, but I'm pulliing my hair out and people are now nagging for some of these web services to be back online, so could do with sorting asap.

    Thanks

  2. #2
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,933
    Did you run any updates to this? Normally, on a CentOS or RedHat system if you installed Apache through the package manager you'll find your web files are in /var/www and your config is in /etc/httpd.

    If someone has been running apache from /wwwroot it may be that they've done a source based or custom install of apache from somewhere else. That will cause you problems if you want to find where the default httpd.conf file is supposed to be.

    To find which httpd.conf is supposed to be used, you are probably safe to go hunt them all down and just use the newest. To find which one is supposed to be used, move them all to a new subdirectory in /root then try to start apache. I'll complain through the logs (/var/log/httpd/) that it cannot find its config file and tell you where it's looked. Then just copy the one you want to use into that location.

    A more drastic alternative would be to back up all the httpd conf files, uninstall or otherwise remove the version of apache that is installed then reinstall it from the package manager. After that is done you can merge in the config from your known live httpd.conf file. I would only do this as a last resort, though - this could be a tricky operation if you're not very familiar with Apache.
    Linux user #126863 - see http://linuxcounter.net/

  3. #3
    Linux Engineer
    Join Date
    Apr 2012
    Location
    Virginia, USA
    Posts
    917
    My guess is you're previous admin installed apache outside the control of the service utility.
    Check rc.local for any start up scripting. Search around in /opt and /usr for other apache installations.

  4. $spacer_open
    $spacer_close
  5. #4
    Just Joined!
    Join Date
    Aug 2012
    Posts
    3
    Thanks for the replies guys. I know for a fact he compiled it from source, he also compiled PHP 5.2 with oracle into the same mounted drive. Makes sense that he did it like that.
    It tells me when I try to start either httpd or apachectl that it's looking in the default folder /etc/http/conf/, I will look around for other installations, but I doubt I'll find any. There are no scripts in rc.local, and I have tried changing the httpd service to look at /wwwroot for it's config file but it doesn't seem to make any difference.

    I did actually try reinstalling apache from yum. I got apache working, I got PHP working from yum (but yum only offers PHP 4), but I needed to compile PHP with OCI8, so I did that from the make file that my predecessor used, but it insisted on always using the one installed by yum and when I removed the yum installation it wouldn't find any PHP installation.

    If I had the time and resources available I think I'd try a blank machine and rebuild the whole thing from scratch, at least then I'd have some idea of how it's all installed.

    I've now reverted back to a snapshot I took before I started messing, I just wish I'd remembered to take a snapshot before I stopped the service, I just never thought it would turn into such a mission! So now I'm back to square one.

    At the moment I'm not too bothered about reconfiguing the httpd file, I just need the webservices to be back up and running.

  6. #5
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,933
    He probably did the installs from source because the official versions in the repositories are too old and didn't support the features needed by the web sites being hosted. You may want to try un-installing apache with yum, then going back to the build directories and doing a fresh 'make install' from the previous build area. It should re-install everything at the level it was built at (i.e. the version that the original installation needed).

    A fresh install may be a good way to go. If you move to the new CentOS 6, you'll find that the newer versions of PHP and Apache you need are already present - you can install the lot from yum without having to build them by hand. I've had CentOS 6 installed in less than an hour before, with a couple of hours after that for basic security config and updates.
    Linux user #126863 - see http://linuxcounter.net/

  7. #6
    Just Joined!
    Join Date
    Aug 2012
    Posts
    3
    Got it.
    when I was running the httpd service, even from within the wwwroot/apache/bin folder it was trying to run the distro default service rather than the custom one.

    \wwwroot\apache\bin\httpd -f \wwwroot\apache\conf\httpd.conf

    got it going

    I am going to setup another machine from scratch with current software though, to help me get my head around the whole installation process. I've enjoyed the last week messing with it, and I've learnt (why is that telling me it's spelt wrong?) a lot.
    This server being down as been a slight inconvenience, but not world ending...but it's only a matter of time before the important ones have a downer, so I should really get an understanding of how they work!

  8. #7
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    3,442
    I second Roxoff´s suggestion to build a new machine on centos 6.
    Depending on the apache and php modules/features chosen on the original machine, this might or might not be trivial though.

    As you reverted to a snapshot, you can try to analyze this old vm by looking at the timestamps of all httpd.confs (updatedb && locate httpd.conf).
    Also a look at the bash history might reveal, how you predecessor started the apache daemon.

    But starting from scratch is definitely the better choice.
    It seems, that this vm is out of date, unmaintained and undocumented.
    You must always face the curtain with a bow.

Posting Permissions

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