Latest blog entry

How to install and configure APC cache on a cPanel server?

July 25, 2012    |   Posted by admin   |    Category: cPanel Management

For a plain Linux server, follow: How to install APC cache on a Linux server?

Installation of APC cache on a cPanel server is pretty easy. Follow the below steps to install APC cache on cPanel server:

1. SSH to the server and execute:

# yum install pcre-devel

2. Goto WHM –> PHP Configuration Editor –> Advanced Mode, change theĀ  “extension_dir” value from

/usr/local/lib/php/extensions/no-debug-non-zts-20060613
to
/usr/lib/php/extensions/no-debug-non-zts-20060613

3. Install APC cache from WHM.

WHM --> Module Installers --> click Manage next to "PHP Pecl".
Search APC and install it.

4. Change PHP Handler to DSO. You can either do this from WHM OR via SSH:

WHM --> Service Configuration --> Apache Configuration -->
Configure PHP and SuExec --> PHP5 Handler
OR
# /usr/local/cpanel/bin/rebuild_phpconf 5 0 dso 1

Once done, make sure apc.so file is present in the /usr/lib/php/extensions/no-debug-non-zts-20060613 directory. Sometimes it is created in the original directory and you have to create a symlink.

# ln -s /usr/local/lib/php/extensions/no-debug-non-zts-20060613/apc.so \
 /usr/lib/php/extensions/no-debug-non-zts-20060613/apc.so

Restart the Apache webserver and to confirm if APC is activated, execute:

# php -i | grep apc
Comments Off on How to install and configure APC cache on a cPanel server?

ssh_exchange_identification: Connection closed by remote host

July 6, 2012    |   Posted by admin   |    Category: Linux Administration

Many a times when accessing a server via SSH you may end up with “ssh_exchange_identification: Connection closed by remote host” error message. For example:

# ssh root@testserver.com
ssh_exchange_identification: Connection closed by remote host

OR may be more descriptive error when you use the verbose mode (-v flag)

# ssh -v root@testserver.com
 OpenSSH_4.0p1, OpenSSL 0.9.7a Feb 19 2003
 debug1: Reading configuration data /etc/ssh/ssh_config
 debug1: Applying options for *
 debug1: Connecting to testserver.com [1.1.1.1] port 22.
 debug1: Connection established.
 debug1: permanently_set_uid: 0/0
 debug1: identity file /root/.ssh/identity type -1
 debug1: identity file /root/.ssh/id_rsa type -1
 debug1: identity file /root/.ssh/id_dsa type 2

The ‘ssh_exchange_identification’ issue occurs for various reasons. So to fix the issue, check the following:

1) TCP wrappers i.e. whether ssh is restricted to certain IPs in /etc/hosts.allow and /etc/hosts.deny. If yes, make sure your local IP is added in the allowed list.

Edit the /etc/hosts.allow file and add the following at the top:

sshd : yourlocalip : allow

2) The /var/empty/sshd folder should be owned by user ‘root’. Sometimes if a new application is installed, it somehow changes the ownership of the /var/empty/sshd directory resulting in ‘ssh_exchange_identification’ error message.

# chown root.root /var/empty/sshd -R

3) If the permission of the private key files are incorrect i.e. if private key files are readable by all, it also results in “ssh_exchange_identification: Connection closed by remote host” error.

For example, if any of the private key file “ssh_host_key, ssh_host_rsa_key or ssh_host_dsa_key” in /etc/ssh directory have 644 permissions, they should be set to 600.

# cd /etc/ssh
# chmod 600 ssh_host_key ssh_host_rsa_key ssh_host_dsa_key
Comments Off on ssh_exchange_identification: Connection closed by remote host