[FreeBSD] Can't get Apache2 running

Discussion in 'Linux & BSD' started by Glaanieboy, May 11, 2004.

  1. Glaanieboy

    Glaanieboy Moderator

    Messages:
    2,626
    Location:
    The Netherlands
    Alright, the ports/kernel upgrade went fine, so I could finally install some apps. I began with MySQL4.0. Installation went fine, restarted, deamon started up and runs like hell ;). Next was Apache2, installation went (apperantly) fine, but I can't start httpd. I did /usr/local/sbin/httpd -k start, but nothing happens. When trying a -k restart, it says httpd isn't started and it tries to start httpd again, but no effect. What can went wrong? There can't be an error in the httpd.conf file, because the only error it gave, was that he couldn't find this module:
    Code:
    #LoadModule ext_filter_module libexec/apache2/mod_ext_filter.so
    But I commented that out already with a nice #. Oh and I added two lines:
    Code:
    AddType application/x-httpd-php .php
    AddType application/x-httpd-source .phps
    for use with PHP (of course that is installed)
    Oh and I set the Listen and Servername to 192.168.0.4:80 (it's IP). Is that good?
     
  2. j79zlr

    j79zlr Glaanies script monkey Political User

    Messages:
    2,725
    Location:
    Chicago
    what does apachectl start do for ya?

    I use Listen 80, but that should work

    You don't want that as your servername, use

    Servername www.glaanieboy.dyndns.org
    ServerAlias glaanieboy.dyndns.org *.glaanieboy.dyndns.org

    ^ assuming dyndns name.
     
  3. Glaanieboy

    Glaanieboy Moderator

    Messages:
    2,626
    Location:
    The Netherlands
    the same as httpd -k start ... nothing :(
     
  4. Geffy

    Geffy Moderator Folding Team

    Messages:
    7,805
    Location:
    United Kingdom
    firstly the last time I checked you have to do something manually to get php4 to work with apache2, so if you "make deinstall clean distclean" for apache2 and mod_php4 then get ready to start it again
    in /usr/ports/www/mod_php4 type "make install -DWITH_APACHE2"
    fill in the options you want in the menu you are presented with once php4 has been downloaded.

    Once it has finished compiling apache2 and php4 (it will do the apache2 as part of the mod_php4 compile and install as it is a dependency)
    I believe the command you have to enter to get the php4 libs properly seen and into apache2 you have to do
    /usr/local/share/apache2/build/libtool --finish /usr/ports/www/mod_php4/work/php-4.3.5/libs

    it gets the libs from the php port work dir which is why we didnt do "make install clean -DWITH_APACHE2"

    next just edit the httpd.conf file in /usr/local/etc/apache2/ to add the .php and .phps types and also add index.php to the directory index

    you dont really need to restart the machine to get apache running just type
    apachectl start
    or
    /usr/local/etc/rc.d/apache2.sh start

    hope this works and helps
     
  5. j79zlr

    j79zlr Glaanies script monkey Political User

    Messages:
    2,725
    Location:
    Chicago
    ok, enable wildcard in dyndns if you want to enalbe the www. or any prefix

    Is httpd running? It should throw you an error if there is something wrong with the httpd.conf file. Are you trying to start as root? What happens if you try and go to http://localhost or http://192.168.0.4 in a browser
     
  6. j79zlr

    j79zlr Glaanies script monkey Political User

    Messages:
    2,725
    Location:
    Chicago
    Geffy, IIRC using mod_php4 does not require any extra make arguments, but the lang/php4 port does.
     
  7. Glaanieboy

    Glaanieboy Moderator

    Messages:
    2,626
    Location:
    The Netherlands
    Well, for the moment my router is still redirecting port 80 requests to my workstation (soon to be ex-server), so I put it's IP instead. But nevertheless I tried your solution, and it gave an error at the ServerAlias, saying I could only use that for Virtual Hosts, which I don't have.

    But I am thinking you didn't quite understood what I was saying. Apparently my httpd.conf is fine, but the httpd deamon isn't starting up at all. When I issue the command apachectl start or httpd -k start, I look at the ps xa list and I don't see it running. Nor do I see it listening to ports with netstat. So something else is very wrong here.
     
  8. Glaanieboy

    Glaanieboy Moderator

    Messages:
    2,626
    Location:
    The Netherlands
    While typing the post, I didn't see your other posts guys, sorry. I am gonna try it like Geffy said and I'll report back when I have more info.
     
  9. Geffy

    Geffy Moderator Folding Team

    Messages:
    7,805
    Location:
    United Kingdom
    If you give make arguments to mod_php4 they get past to lang/php4, if you define WITH_APACHE2 then it makes mod_php4 depend on apache2 and not apache13
     
  10. Glaanieboy

    Glaanieboy Moderator

    Messages:
    2,626
    Location:
    The Netherlands
    Alright Geffy, I tried your guide, but still nothing. It just won't run. And yes I am logged in as root (actually logged in as a normal user and su'ed to root).
     
  11. j79zlr

    j79zlr Glaanies script monkey Political User

    Messages:
    2,725
    Location:
    Chicago
    Glannie, PHP will have nothing to do with apache not running actually. You should try and troubleshoot apache first, although pretty difficult without any errors.
     
  12. Glaanieboy

    Glaanieboy Moderator

    Messages:
    2,626
    Location:
    The Netherlands
    Will do that tomorrow. I am sleepy.
     
  13. Xie

    Xie - geek - Subscribed User Folding Team

    Messages:
    5,275
    Location:
    NY, USA
    Check out your error log and see if apache is producing any errors when trying to start it perhaps.
     
  14. Glaanieboy

    Glaanieboy Moderator

    Messages:
    2,626
    Location:
    The Netherlands
    Damn! Why didn't I think of that :rolleyes: Stupid me. It turned out mod_unique_id was giving the problems. I disabled it and everything works fine now :)
     
  15. j79zlr

    j79zlr Glaanies script monkey Political User

    Messages:
    2,725
    Location:
    Chicago
    Good to hear :)
     
  16. Xie

    Xie - geek - Subscribed User Folding Team

    Messages:
    5,275
    Location:
    NY, USA
    what he said :D
     
  17. Glaanieboy

    Glaanieboy Moderator

    Messages:
    2,626
    Location:
    The Netherlands
    I have looked up what mod_unique_id does, I found this on http://www.apachefreaks.com/apache2/mod/mod_unique_id.html:
    :confused: Can someone translate this to English?
     
  18. Geffy

    Geffy Moderator Folding Team

    Messages:
    7,805
    Location:
    United Kingdom
    hrmm
    *wonders if thats the module that generates session ids
     
  19. Glaanieboy

    Glaanieboy Moderator

    Messages:
    2,626
    Location:
    The Netherlands
    :eek: I hope not, that means half my website doesn't work :eek:
     
  20. Geffy

    Geffy Moderator Folding Team

    Messages:
    7,805
    Location:
    United Kingdom
    put
    <?php echo phpinfo(); ?>
    into a php file and look at the output, there should be a session ID field somewhere in that page, if there isnt one then you might have a problem