apache won't restart

I’ve seen this issue in these forums and other forums but I cannot seem to find a solution. here’s my scenerio.

i’m running vm GPL with centos 5.5 openvz vps.

  1. i went to restart apache just now and got this which you’ve probably already seen:
    Failed to start service :
    Starting httpd: (98)Address already in use: make_sock: could not bind to address [::]:80
    (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
    [FAILED]

  2. i then restart the vps and apache is fine. I then try to restart apache again via gui and the same message comes up.

  3. I run “netstat -lnp | grep 0.0.0.0:80” nothing comes up.

  4. i commented out LIsten 80 in /etc/httpd/conf/httpd.conf and that didn’t work

I know if I restart the vps it will be ok, but if i ever have to restart just apache, it will be an issue i’m sure.

Any idea what’s going on? I have 1.5GB of ram and 1core allotted for this vps so i can’t imagine it’s a resource issue. Also, could there be something else listening to port 80?

Howdy,

One other thing you may want to look for is to see if any Apache processes are running. You can do that by typing:

ps auxw | grep httpd

It’s possible that some process got stuck and needs to be manually killed off.

-Eric

i ran that and got this:

apache 11655 99.7 0.2 244460 4056 ? R 13:59 61:47 /usr/sbin/httpd
root 20403 0.0 0.0 61160 764 pts/0 S+ 15:01 0:00 grep httpd

i guess I kill that 11655 pid, but how is it there?

Ok, i did kill that pid and it now restarts via gui over and over again. which is great! But I wonder why that 1 apache process was running after vps restart.

Well, while it’s difficult to explain why exactly, it looks like a process may have gotten stuck for some reason.

So, I’d start by killing it, and seeing if it does solve the problem.

If so – the next question is to figure out why that’s happening :slight_smile:

I’m not really sure why, it may be an application you’re using, it may be something in the FCGID or mod_php mode, or it could be a bug in Apache.

If you have a small number of websites, one thing you could try is to change the PHP execution mode to CGI, rather than FCGID or mod_php, and see if that makes a difference.

You can change that in Server Configuration -> Website Options -> PHP Execution Mode.

-Eric

Eric,

Thanks so much! it may have been something i did while installing zend and ioncube. Who knows. The good thing is that it restarts now and if I get that message again, I can just kill the extra apache processes and we’ll be good to go.

Now the execution mode I’m a little confused about. Currently i’m set to Apache mod_php (run as Apache’s user)

I will have more than one virtual server on this machine so would I pick FCGId or just stay with what I have?

what is the difference between these and is there a benefit by choosing either or? I mean I see the explanations, but some are the same explanations ie. CGI and FCGId (run as virtual server owner), but it seems mod_php and FCGId is more secure for shared environment? Let me know if there is some more detailed explanations of these. I want it to be as secure as possible server, yet reasonably loose with php script installations so website actually work without too many issues and meticulous configurations.

Apache mod_php (run as Apache’s user)
CGI wrapper (run as virtual server owner)
FCGId (run as virtual server owner)

I would stay with Virtualmin’s default settings (which is fcgid currently).

But to answer your questions.

If you plan to use worker MPM (“thread based”) instead of prefork (“process based”), you can not use mod_php.

If you are the only user/owner for all your virtual servers and/or all pther users are trusted, then it is ok to use mod_php. If you host for other users it is probably better not to use mod_php for security reasons etc.

Is there a place to check to make sure it’s the default set to FCGId? Because everytime I add a new virtual server they’re always set to mod_php by default so I don’t know how that happened.

Nevermind I found it here:

Virtualmin> System Settings> Server Templates> Default Settings > form “Edit template section:” select “Apache website”.

Thanks guys!