Saturday, December 26, 2009

How to upgrade PHP version plesk linux server

Some forums need minimum PHP 5.2.x installed on the server and plesk install php 5.1.6 by default. To upgrade PHP version, just login to shell with root access and execute following commands.

wget -q -O - http://www.atomicorp.com/installers/atomic.sh | sh
yum update php

Friday, December 25, 2009

Setting up the default index page using .htaccess

If you have 2 index page i.e index.html and index.php and by default web browser is showing index.html and if you want to change it to index.php then you can do that by adding following code in to .htaccess.

DirectoryIndex index.php index.html

Thursday, December 24, 2009

child pid xxx exit signal Segmentation fault (11)

[Thu Dec 24 09:12:03 2009] [notice] child pid 8877 exit signal Segmentation fault (11)
[Thu Dec 24 09:12:38 2009] [notice] child pid 8466 exit signal Segmentation fault (11)
[Thu Dec 24 09:12:38 2009] [notice] child pid 8883 exit signal Segmentation fault (11)
[Thu Dec 24 09:12:39 2009] [notice] child pid 8760 exit signal Segmentation fault (11)
[Thu Dec 24 09:12:47 2009] [notice] child pid 8781 exit signal Segmentation fault (11)

When you get above errors in apache error logs then just make following changes in to httpd.conf

Add following line in main config section:
===========================
CoreDumpDirectory /tmp/apache2-gdb-dump
===========================

Create following folder as well and change the permission
=====================
mkdir -p /tmp/apache2-gdb-dump
chmod 0777 /tmp/apache2-gdb-dump
=====================

Sunday, December 13, 2009

Connection refused 111 Can't open SMTP stream

If you are getting following error while sending email from SquirrelMail then just restart Ip tables or stop and start IPtabls. That will fix the issue

=====================================
Connection refused 111 Can't open SMTP stream
=====================================

Command to restart Iptables

=====================================
/etc/init.d/iptables restart
=====================================

Commands to stop and start IPtables
=====================================
/etc/init.d/iptables stop
/etc/init.d/iptables start
=====================================

Wednesday, December 2, 2009

cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly

Sometimes phpMyadmin will give you following error.

“cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly.”

Make the following changes.


root@server[~]#nano /usr/local/cpanel/3rdparty/etc/phpmyadmin/php.ini
And than change the following values in php.ini file

FROM:
—–
session.save_handler = sqlite
session.save_path =/var/cpanel/userhomes/cpanelphpmyadmin/sessions/phpsess.sdb

—–
TO
—–
session.save_handler = files
session.save_path = /tmp



Restart cpanel 

Saturday, November 7, 2009

Mailman Error "Bug in Mailman version 2.1.11.cp3"

If you are getting following error when trying to modify mailinglist then execute following command on shell

Error
===============

Bug in Mailman version 2.1.11.cp3

We're sorry, we hit a bug!

Please inform the webmaster for this site of this problem. Printing of traceback and other system information has been explicitly inhibited, but the webmaster can find this information in the Mailman error logs.

===============

Command

=================
chmod 02775 -R /usr/local/cpanel/3rdparty/mailman/
=================

Monday, October 26, 2009

/usr/local/cpanel/base/horde/imp/lib/MIME/Viewer/plain.php on line 132

If you are getting following error while reading emails in Horde in cpanel + CentOS server then just reset horde with following command on shell with root access.

Error
====================================================

/usr/local/cpanel/base/horde/imp/lib/MIME/Viewer/plain.php on line 132
====================================================

Command
=========================================
/scripts/resethorde
=========================================

There seems to be be something wrong with latest cpanel upgrade.




Thursday, October 22, 2009

How to stop generating core files

You may come across core files which gets generated within your accounts . The possible reason for the core files getting generated is when a php process is killed, apache creates core files under your account .

On phpSuexec servers this may cause due to incorrect php.ini file placed in your account and if it is caused due to php/apache then you can get rid off those core files by editing the httpd startup file on the server end. Following are the steps to edit httpd startup file.

========================================================
root@server [~]#which httpd
/usr/sbin/httpd
root@server [~]# nano /usr/sbin/httpd

Search for ulimit lines .For eg : you can see these lines

ulimit -n 1024
ulimit -n 4096
ulimit -n 8192
ulimit -n 16384

You need to add ulimit -c 0 at the end .Which will look like :

ulimit -n 1024
ulimit -n 4096
ulimit -n 8192
ulimit -n 16384
ulimit -c 0


Save File


Restart httpd

root@server [~] /etc/init.d/httpd restart 
======================================================

Sunday, October 18, 2009

Effective way of killing zombie process

Here is a most effective way to find a zombie process and kill them
============================================
Execute following command on shell

#ps -el | grep Z

this will give you the zombie process data including its Parent Process ID (PPID), which we need to take care of.
#kill -9 PPID
where PPID is the Parent Process ID you got from the previous command.
============================================

How to kill zombie process automatically

Write a script and schedule as a cron job.

==================================
for each in `ps auxww | grep Z | grep -v PID | awk ‘{print $3}’`; do for every in `ps auxw | grep $each | grep cron | awk ‘{print $2}’`; do kill -9 $every; done; done
==================================

How to kill zombie process + CentOS + Cpanel

Execute following command on shell
=================================================================
# ps aux | awk '{ print $8 " " $2 }' | grep -w Z    or ps aux | awk '$8=="Z" { print $2 }'
Output is :
Z 1926
Z 4858
Z 3726


To kill a zombie
# kill -91926 4858 3726
===================================================================

Friday, October 16, 2009

What is Zombie process

A zombie process or defunct process is a process that has completed execution but still has an entry in the process table. This entry is still needed to allow the process that started the (now zombie) process to read its exit status. The term zombie process derives from the common definition of zombie—an undead person. In the term's colorful metaphor, the child process has died but has not yet been reaped. When a process ends, all of the memory and resources associated with it are deallocated so they can be used by other processes. However, the process's entry in the process table remains. The parent can read the child's exit status by executing the wait system call, at which stage the zombie is removed. The wait call may be executed in sequential code, but it is commonly executed in a handler for the SIGCHLD signal, which the parent receives whenever a child has died. After the zombie is removed, its process ID and entry in the process table can then be reused. However, if a parent fails to call wait, the zombie will be left in the process table. In some situations this may be desirable, for example if the parent creates another child process it ensures that it will not be allocated the same process ID. On modern UNIX-like systems (that comply with SUSv3 specification in this respect), the following special case applies: if the parent explicitly ignores SIGCHLD by setting its handler to SIG_IGN (rather than simply ignoring the signal by default) or has the SA_NOCLDWAIT flag set, all child exit status information will be discarded and no zombie processes will be left.

A zombie process is not the same as an orphan process. An orphan process is a process that is still executing, but whose parent has died. They do not become zombie processes; instead, they are adopted by init (process ID 1), which waits on its children.

Zombies can be identified in the output from the Linux ps command by the presence of a “Z” in the “STAT” column. Zombies that exist for more than a short period of time typically indicate a bug in the parent program, or just an uncommon decision to reap children (see example). As with other leaks, the presence of a few zombies is not worrisome in itself, but may indicate a problem that would grow serious under heavier loads. Since there is no memory allocated to zombie processes except for the process table entry itself, the primary concern with many zombies is not running out of memory, but rather running out of process ID numbers.

To remove zombies from a system, the SIGCHLD signal can be sent to the parent manually, using the kill command. If the parent process still refuses to reap the zombie, the next step would be to remove the parent process. When a process loses its parent, init becomes its new parent. Init periodically executes the wait system call to reap any zombies with init as parent.