Archive for » October, 2008 «

Saturday, October 25th, 2008 | Author: Angelo

ERROR: Connection dropped by IMAP server.

Common error while accessing email account via squirrel mail client on cPanel server. This error occurs due to wrong ownership of file or folder located under etc or mail directory. Here is what worked for me on cPanel server. Suppose cPanel username is xyz to fix the issue execute following commands on server.

[root@server ]#cd /home/xyz
[root@server ]#chown xyz.xyz mail -R
[root@server ]#chown xyz.mail etc -R

Wednesday, October 22nd, 2008 | Author: Angelo

phpMyAdmin - Error

#2002 - The server is not responding (or the local MySQL server’s socket is not correctly configured)

Here is what worked for me on cPanel server.

root@server [~]# vi /usr/local/cpanel/base/3rdparty/phpMyAdmin/config.inc.php

find
$cfg['Servers'][$i]['socket'] = ”;
change to
$cfg['Servers'][$i]['socket'] = ‘/var/lib/mysql/mysql.sock‘;

next line
$cfg['Servers'][$i]['connect_type'] = ‘tcp‘;
change to
$cfg['Servers'][$i]['connect_type'] = ‘socket‘;

now restart mysql service

root@server [~]# /etc/init.d/mysql restart

Saturday, October 18th, 2008 | Author: Angelo

How to keep ssh connection alive ?

While working remotely using ssh, you may have experienced ssh connection is closed (disconnected) while you are out for a tea or when you leave sshconnection inactive for few mins. It is very annoying that ssh connection getting disconnected again and again. Here is script which help you to keep ssh connection alive.

Executing following script to keep your ssh connection alive. This script will keep executing commands hostname and date every after 60 seconds so your ssh connection will never inactive more than 60 secs.

Edit the file keepalive.sh using vi editor and add following lines in the same.
[root@linuxserver ~]#vi keepalive.sh

#!/bin/sh

if [ $# -eq 1 ]; then
sleep_time=”$1″
else
sleep_time=60
fi

while true; do echo "`hostname` `date`"; sleep $sleep_time;done

now execute it as given below

[root@linuxserver ~]#sh keepalive.sh 60

When you will return to your work you can terminate this running script by pressing ctrl + c.

Friday, October 17th, 2008 | Author: Angelo

Command grep is used for printing lines which matches to a pattern you have defined.
Exercise ::
For example there is one file name is test contains following lines.
is it test file ?
is it test file

Now pattern you defined is ? means you are trying to print all lines which contain ? (question mark) from file test.
Usually we try follow command.
cat test | grep ?

But output will show both lines because grep treat ? as single character both lines contains more than single character. Solution for grep lines containing ? (symbol) is define ?(special character) in []
cat test | grep [?]
is it test file ?

Same in case of all special character *, . , ‘ , ” , }, ) . This trick will help you when you need to search all lines containing defined pattern from log files. Also useful in shell scripting.

Friday, October 17th, 2008 | Author: Angelo

What is Xcache ? :: Xcache help to accelerates the performance of PHP on servers. It optimizes performance by excluding compilation time of PHP scripts by caching the compiled state of PHP scripts into the RAM and uses the compiled version directly from the RAM. Which help to increase the rate of page generation time by up to 5 times as it also optimizes many other aspects of php scripts and help to reduce serverload.

Installing Xache module:

XCache is a fast, stable PHP opcode cacher that has been tested on linux server and running under high load.
XCache 1.2.1 is release is compatible with apache1/ZendOptimizer/ZendCore compatibility. This version support only support 4.3.x 4.4.x 5.1.x and 5.2.x but does not support the PHP 5.0.x series, also note Xcache is not compatible with IONCUBE.

Installation:
[root@linuxserver ~]# wget http://xcache.lighttpd.net/pub/Releases/1.2.1/xcache-1.2.1.tar.gz
[root@linuxserver ~]# tar -xzf xcache-1.2.1.tar.gz
[root@linuxserver ~]# cd xcache-1.2.1
[root@linuxserver ~]# phpize
[root@linuxserver ~]# ./configure –enable-xcache –enable-xcache-optimizer
[root@linuxserver ~]# make
[root@linuxserver ~]# make install

Adding extensions and configuring xcache in php.ini you can find location of php.ini file by following command
[root@linuxserver ~]# php -i | grep php.ini
Now edit php.ini file.
Under ? extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20060613" line add following parameter to enable xcache.

extension = xcache.so

[xcache.admin]
; Change xcache.admin.user to your preferred login name
xcache.admin.user = "admin" ? no need to add system user.

; Change xcache.admin.pass to the MD5 fingerprint of your password
; Use md5 -s "your_secret_password" to find the fingerprint
xcache.admin.pass = "cd959ac3debe8f587546a3fa353b3268" ? Password in MD5(op3nsesam3)

[xcache]
; Change xcache.size to tune the size of the opcode cache
xcache.size = 128M
xcache.shm_scheme = "mmap"
xcache.count = 2
xcache.slots = 8K
xcache.ttl = 0
xcache.gc_interval = 0

; Change xcache.var_size to adjust the size of variable cache
xcache.var_size = 8M
xcache.var_count = 1
xcache.var_slots = 8K
xcache.var_ttl = 0
xcache.var_maxttl = 0
xcache.var_gc_interval = 300
xcache.test = Off
xcache.readonly_protection = On
xcache.mmap_path = "/tmp/xcache"
xcache.coredump_directory = ""
xcache.cacher = On
xcache.stat = On
xcache.optimizer = On

[xcache.coverager]
xcache.coverager = On
xcache.coveragedump_directory = ""

save and quit.

Restart httpd service.

Now from xcache source copy the "admin" directory to your htdocs from where you can manage the xache.
http://server-ip/admin/

Thursday, October 16th, 2008 | Author: Angelo

Defining variable in shell scripting.

For processing data, it must be store in RAM memory. Generally RAM memory is divided into small locations, and each location had unique number called memory address, which is used to hold our data. scripting can give a unique name to this address of ram called memory variable or variable. You can call this as storage location which can have different value but only one at the time.

There are two types of variables:

[A} Variable defined by Linux are known as system variable. All theses variable are defined in capital letters.
[B] Variables defined by user are known as user defined variables. You can define them in capital letters as well as in small letter or can be define using capital or small letter. But it is recommended that small letters should be used while defining user defined variables.

Determine system defined variable (also know as environment variables) by command env it will show you all variable created by Linux with value assigned to the same.

[root@server ~]#env

Exercise: User defined variables.

When variable name is followed by =value, the value of the variable is set to value.

Let’s define variable angelo with value scripting

[root@server ~]#angelo=scripting
[root@server ~]#echo $angelo

scripting

Wednesday, October 15th, 2008 | Author: Angelo

In apache error log if you find error for a account as “Warning: Cannot modify header information - headers already sent by blah,blah…”

Then simply open .htaccess and put following code
php_flag output_buffering on

In case of php-suexec server create php.ini file under respective directory and add turn on output buffering.

Monday, October 13th, 2008 | Author: Angelo

Internal server error
Could not fetch uid or gid for : cpanel-phpmyadmin

Verify user cpanel-phpmyadmin exists by command
[root@server ~]#grep cpanel-phpmyadmin /etc/passwd

If it doesn’t exist then add user cpanel-phpmyadmin
useradd cpanel-phpmyadmin -d /var/cpanel/userhomes/cpanel-phpmyadmin

Now, assign appropiate ownership to /var/cpanel/userhomes/cpanel-phpmyadmin
chown cpanel-phpmyadmin.cpanel-phpmyadmin /var/cpanel/userhomes/cpanel-phpmyadmin -R

Restart mysql and try once again to access phpmyadmin.

Monday, October 13th, 2008 | Author: Angelo

Child pid x exit signal File size limit exceeded:

The error is cause of File size limit. With 32 Bit system apache support max filesize upto 2GB. If any file accessed/required by apache exceeds this limit, you will get above error. You can check for the file under “/usr/local/apache/domlogs“. To sort all files under this directory by size use command ls -lSh | more. Once you get the file with size 2 GB simply recreate and assign appropriate ownership to the same.

Monday, October 13th, 2008 | Author: Angelo

lowest numbered MX record points to local host

Generally you will get error lowest numbered MX record points to local host if entry for that domain doesn’t exists under /etc/localdomains or hostname is missing from localdomain simply adding it in localdomain will fix the issue. In case, if domains MX record is pointing to remote mail server then remove domain from localdomain and add it in /etc/remotedomains.