Archive for the ‘Apache’ Category

Apache: [emerg] (28)No space left on device: Couldn’t create accept lock

[notice] suEXEC mechanism enabled (wrapper: /usr/local/apache/bin/suexec)
[crit] (28)No space left on device: mod_rewrite: Parent could not create RewriteLock file /usr/local/apache/logs/rewrite_lock

semget: [emerg] (28) No space left on device OR Apache: No space left on device: Couldn’t create accept lock

You may receive “No space left on device” message while starting the Apache service, however, it has nothing to do with the disk space. The reason behind the error message is Semaphores.

You will have to kill the active semaphore processes in order to start Apache service successfully.

To list the PIDs of the active semaphore processes, execute:

# ipcs -s
—— Semaphore Arrays ——– key
semid owner perms nsems
0×00000000 366673220 apache 600 1
0×00000000 366706589 apache 600 1
0×00000000 366732358 apache 600 1
0×00000000 366734353 apache 600 1
It will list all the PIDs which need to be killed:

# ipcrm -s PID

If you have a long list of processes, execute the following commands:

# ipcs -s | grep apache | awk ‘ { print $2 } ‘ | xargs ipcrm sem
#for i in `ipcs -s | awk ‘{print $2}’`; do (ipcrm -s $i); done

Replace ”apache’ in the above command with the actual “owner” of the processes returned in the “ipcs -s” command. Apache will start successfully once these processes are killed.

What is a Semaphore?

Semaphores are use to communicate between active processes. Apache write down some information of such processes before the communication actually begins and if Apache fails to write the information, it results in the “No space left on device: Couldn’t create accept lock” error message.



imitipconn is a tool which is used to limit the number of connections per IP on our server. This tool can help in lowering the load on your server if someone connecting too many times from the same IP.

First we need to download the file.


#tar -xjf mod_limitipconn-0.23.tar.bz2

#cd mod_limitipconn-0.23/

Now, we are compile the module into Apache using:

#/usr/local/apache/bin/apxs -cia mod_limitipconn.c

Update the httpd.conf file using this command:

#/usr/local/cpanel/bin/apache_conf_distiller –update


Edit the file using vim or vi

vim /usr/local/apache/conf/mod_limitipconn.conf

Lets add in the following lines to the bottom of the file:

# Set a server-wide limit of 10 simultaneous downloads per IP,

# no matter what.

MaxConnPerIP 10

# This section affects all files under http://your.server/somewhere

MaxConnPerIP 3

# exempting images from the connection limit is often a good

# idea if your web page has lots of inline images, since these

# pages often generate a flurry of concurrent image requests

NoIPLimit image/*

# This section affects all files under /home/*/public_html

MaxConnPerIP 3

# In this case, all MIME types other than audio/mpeg and video*

# are exempt from the limit check

OnlyIPLimit audio/mpeg video

Now edit the file /usr/local/apache/conf/includes/pre_main_global.conf and add the following lines

Include “/usr/local/apache/conf/mod_limitipconn.conf”

Now restart apache


You can check whether the module loaded or not using the following command.

/usr/local/apache/bin/httpd -M | grep limitipconn_module
/usr/sbin/httpd -t


1) This module will not function unless mod_status is loaded and the
“ExtendedStatus On” directive is set.

2) Server-wide access restrictions and per-directory access restrictions
are computed separately. In the above example, if someone is
downloading 11 images from http://your.server/somewhere
simultaneously, they WILL be denied on the 11th download, because the
server-wide limit of 10 downloads is not affected by the per-directory
NoIPLimit. If you want to set global settings which can be overruled
by per-directory settings, you will need something like

# global per-directory settings here

# local per-directory settings here

3) If you are using any module based upon a quick handler hook (such as
mod_cache), mod_limitipconn will not be able to process any
per-directory configuration directives in time to affect the return
result of the other module. This is a technical limitation imposed
by Apache. In such a situation, you will have to use server-wide
configuration directives only.

Note that previous versions of mod_limitipconn did not allow any
server-wide configuration directives, and hence could not be used
with mod_cache at all. In other words, the present situation still
represents an improvement over previous versions.

4) The limits defined by mod_limitipconn.c apply to all IP addresses
connecting to your Apache server. Currently there is no way to set
different limits for different IP addresses.

5) Connections in excess of the limit result in a stock 503 Service
Temporarily Unavailable response. The job of returning a more useful
error message to the client is left as an exercise for the reader.

6) mod_limitipconn sets the LIMITIP environment variable to 1 whenever a
download is denied on the basis of too high an IP count. You can use
this variable to distinguish accesses that have been denied by this
module. For example, a line like

CustomLog /var/log/httpd/access_log common env=!LIMITIP

in httpd.conf can be used to suppress logging of denied connections
from /var/log/httpd/access_log. (Note that, if you really want to
suppress logging, you’ll probably also want to comment out the
ap_log_rerror lines from mod_limitipconn.c as well.)

7) By default, all clients behind a proxy are treated as coming from the
proxy server’s IP address. If you wish to alter this behavior,
consider installing mod_extract_forwarded from

Unable to start Apache service on cPanel server.

If you are getting the following error while trying to restart the Apache service.

-bash-3.2# /etc/init.d/httpd start
(20014)Internal error: Error retrieving pid file logs/
Remove it before continuing if it is corrupted.

Solution :-

-bash-3.2# mv /usr/local/apache/logs/ /usr/local/apache/logs/
-bash-3.2# /etc/init.d/httpd restart
httpd not running, trying to start

Be sure that the apache service is running :

/etc/init.d/httpd status



[Thu Aug 22 13:05:06 2013] [warn] [client] mod_fcgid: can’t apply process slot for /usr/local/cpanel/cgi-sys/php5, referer:

This issue commonly occur due to lower value of MaxRequestsPerProcess.

Solution :-

#vim /usr/local/apache/conf/php.conf

MaxRequestsPerProcess 1000
DefaultMaxClassProcessCount 120
IdleTimeout 60
MaxProcessCount 2000
IPCCommTimeout 40
IPCConnectTimeout 10
MaxRequestLen 10240000


98)Address already in use: make_sock: could not bind to address no listening sockets available, shutting down Unable to open logs

Check the Apache process

root@ [~]# ps aux | grep httpd
root 6846 0.0 0.0 4956 700 pts/0 S+ 04:22 0:00 grep httpd
root 29439 0.0 0.7 145736 125784 ? S 03:06 0:00 /usr/local/apache/bin/httpd -k start -DSSL

Check whether port 80 is listening on the server.

root@ [~]# netstat -lnp | grep :80
tcp 0 0* LISTEN 29439/httpd

The below command will display which service is running on port 80. Please use lsof command before and after the process start. You can see the changes.

lsof -i tcp:80
lsof -i | grep httpd

Kill the process and start the service

root@ [~]# kill -9 29439
root@ [~]# ps aux | grep httpd
root 7258 0.0 0.0 4956 704 pts/0 S+ 04:22 0:00 grep httpd

root@ [~]# /etc/init.d/httpd start
root@ [~]# ps aux | grep httpd
root 7312 17.2 0.7 151624 127688 ? Ss 04:23 0:00 /usr/local/apache/bin/httpd -k start -DSSL
root 7335 0.0 0.7 143376 122460 ? S 04:23 0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody 7336 6.0 0.7 153152 127272 ? S 04:23 0:00 /usr/local/apache/bin/httpd -k start -DSSL
nobody 7337 2.0 0.7 152180 126460 ? S 04:23 0:00 /usr/local/apache/bin/httpd -k start -DSSL
root 7361 0.0 0.0 4960 700 pts/0 S+ 04:23 0:00 grep httpd