Archive for December, 2009


Stopping and Restarting Apache

Stopping and Restarting Apache

In order to stop or restart Apache, you must send a signal to the running httpd processes. There are two ways to send the signals. First, you can use the unix kill command to directly send signals to the processes. You will notice many httpd executables running on your system, but you should not send signals to any of them except the parent, whose pid is in the PidFile. That is to say you shouldn’t ever need to send signals to any process except the parent. There are three signals that you can send the parent: TERM, HUP, and USR1, which will be described in a moment.

To send a signal to the parent you should issue a command such as:

kill -TERM `cat /usr/local/apache2/logs/`

The USR1 or graceful signal causes the parent process to advise the children to exit after their current request (or to exit immediately if they’re not serving anything).

apachectl -k graceful

Sending the HUP or restart signal to the parent causes it to kill off its children like in TERM, but the parent doesn’t exit. It re-reads its configuration files, and re-opens any log files. Then it spawns a new set of children and continues serving hits.

Signal: HUP

apachectl -k restart

Note: Before doing a restart, you can check the syntax of the configuration files with the -t command line argument.


About Semaphore

About Semaphore

Semaphore a term used in UNIX for a variable which acts as a counter.

There may be times when two processes try to access the same file simultaneously. In this event we must control the access of the file when the other process is accessing. This is done by assigning value to semaphore.

Semaphore is stored in kernel so that it can be accessed by all processes.

Details of Semaphore

The command

$ ipcs –s

will give the list of existing semaphores.


How to disable SSL2.0 in apache

To disable the SSL2.0 protocol and forcing 3.0

For apache 1.3, find the line:


and change it to:


Note the 2 changes: a) remove the # character at the beginning of the line, and b) change +SSLv2 to !SSLv2

For apache 2.x, do the same thing, but instead it will be in the /etc/httpd/conf/ssl.conf file, or for the new apache system, /etc/httpd/conf/extra/httpd-ssl.conf (if you have both files, just change it in both).

Source :


semget: No space left on device

semget: No space left on device

This relates to semaphores on your system (you’ve run out). Run the following to clear them out:

ipcs | grep apache | awk ‘{print $2}’ > sem.txt

And then run the following.

for i in `cat sem.txt`; do { ipcrm -s $i; }; done;

Increasing PHP Allowed memory size

Some times we get the following errors Fatal error: Allowed memory size of 123456 bytes exhausted

Php is setup is to limit memory usage per process. If we require more, this limit can be increased.



and set:

memory_limit = 8M ; Maximum amount of memory a script may consume (8MB)

to a higher value, like 20M. Save, exit, then restart apache.


« Prev - Next »