httpd (no pid file) not running while restarting apache

31,470

Solution 1

Use lsof -i :80 {check if the parameter is correct). It's listing all the application that are listening on port 80.

Also try to run apache2 {directly the executable} to check what is happening.

Solution 2

Just kill apache pid ( i think that its 'kill 9950' )

and then try /etc/init.d/apache2 start

Solution 3

From some other people's post, it's due to some applcation binds port 80, so just issue 'killall httpd' then a 'apachectl start' to make things alll normal again.

Share:
31,470

Related videos on Youtube

user5950302
Author by

user5950302

Updated on September 17, 2022

Comments

  • user5950302
    user5950302 almost 2 years

    I am working on ubuntu. I got the error messages while try to restart apache.

    root@XXX:/etc/init.d# sudo /etc/init.d/apache2 restart
     * Restarting web server apache2                                                                                                              apache2: Could not reliably determine the server's fully qualified domain name,                                                               using xxx.xxx.xx.xxx for ServerName
    httpd (no pid file) not running
    apache2: Could not reliably determine the server's fully qualified domain name,                                                               using xxx.xxx.xx.xxx for ServerName
    (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
    no listening sockets available, shutting down
    Unable to open logs
    

    I got the following message when tried netstat -pant

    tcp        0   0 0.0.0.0:80              0.0.0.0:*               LISTEN      0          32748       9950/httpd
    
    tcp      429      0 xxx.xxx.xx.xxx:80       xxx.xxx.xx.xxx:xxxxx    CLOSE_WAIT  0          0          
    
  • user5950302
    user5950302 over 13 years
    I have tried it but apache2 start shows same errors
  • Arenstar
    Arenstar over 13 years
    You need to kill what ever is running on port 80... The PID complaint is only because you are trying to stop something that hasnt written a pid.. ( not important ) Is this an aptitude install? Or a precompiled version of apache?
  • Saurabh Barjatiya
    Saurabh Barjatiya over 13 years
    If kill does not work you can also try 'killall -9 httpd', verify using 'ps -C httpd' that process got killed and then use '/etc/init.d/apache2 start'.
  • Michael Hampton
    Michael Hampton over 10 years
    And after that, then what?
  • KeitelDOG
    KeitelDOG over 3 years
    After upgrade from High Sierra to Catalina in MacOs, same thing, seems like a bug. After running sudo killall -9 httpd, the built-in apache stop serving. sudo apachectl stop never stop it, but sudo apachectl start will start it.
  • KeitelDOG
    KeitelDOG over 3 years
    Realizing that apachectl will auto-restart each time I killall httpd. The way I stopped it was to unload it from launchctl: sudo launchctl unload /System/Library/LaunchDaemons/org.apache.httpd.plist