MyTrueHost launched Web Hosting for Indian clients just in Rs 60/Month with various payment options(netbanking, debit card, credit card,cash card or paypal).
Please Visit at https://www.mytruehost.in

Horde Webmail error

Situation:

If you are getting the following error on Horde webmail interface:

Warning: Failed opening ‘Net/Socket.php’ for inclusion(include_path=’.:/usr/share/pear’) in /usr/share/pear/Net/SMTP.php on line 93

Fatal error: Cannot instantiate non-existent class: net_socket in
/usr/share/pear/Net/SMTP.php on line 95

Solution:

Check if the Pear package Net_Socket is present on the server:

pear list|grep Net_SocketNet_Socket           1.0.8   stable

If not present, install it.

pear install Net_Socket

If it is already present, check if the file Socket.php is present in /usr/share/pear/Net/ folder. Most probably this will be missing.

If so download the package Net_Socket. Extract the tar file and copy the file Socket.php from the package to /usr/share/pear/Net/

wget http://download.pear.php.net/package/Net_Socket-1.0.8.tgztar -xzvf Net_Socket-1.0.8.tgz

cd Net_Socket-1.0.8

cp Socket.php /usr/share/pear/Net/

Check Horde Webmail now.

 

WordPress Multisite configuration

In order to configure WordPress multisite, please follow the steps below:

Steps to install WordPress:
==========================

There are two ways by which we can install WordPress.

1. WordPress installation from cPanel:

~~~~~
1. Login to the cPanel of the domain.

====
http://domain_name/cpanel
====

2. Click on “Fantastico De Luxe” under “Software/services”.

3. In the following page, you will see the list of available applications.

4. Click on WordPress and proceed with the installation steps.
~~~~~

2. WordPress manual installation:

~~~
1. Download and extract the WordPress package.

===
http://wordpress.org/download/release-archive/
===

1.1. If you want to have your WordPress installation in the root directory of your domain (e.g. http://test.com/), move all contents of the unzipped WordPress directory (but excluding the directory itself) into the root directory of your domain.

1.2. If you want to have your WordPress installation in a sub-directory on your web site (e.g. http://test.com/blog/), rename the directory ‘wordpress’ to the name you’d like the sub-directory to have.

2. Rename the wp-config-sample.php file to wp-config.php.

~~~~
mv wp-config-sample.php wp-config.php
~~~~

3. Open wp-config.php using your favorite text editor (vi/nano) and change the database details.

Replace the MySQL settings with the following details.

~~~~~~~~~
“database_name_here” with the database created for wordpress domain.
“username_here” with the database user name.
“password_here” with DB user password.
~~~~~~~~~

Sample MySQL section:

===
// ** MySQL settings – You can get this info from your web host ** //
/** The name of the database for WordPress */
define(‘DB_NAME’, ‘test_DB’);

/** MySQL database username */
define(‘DB_USER’, ‘test_user’);

/** MySQL database password */
define(‘DB_PASSWORD’, ‘B2Eqa2k2Tisno’);
===

4. Install WordPress by accessing the installation script located at wp-admin/install.php in a web browser.

For Example:

++++++
WordPress installation in root directory: visit: http://test.com/wp-admin/install.php
WordPress installation in a sub-directory: visit: http://test.com/blog/wp-admin/install.php
++++++
~~~

NOTE:: Assumed that MySQL database is created already.

WordPress multisite configuration:

1. Open the file “wp-config.php” using your favourite text editor or via FileManager.

NOTE:: Before editing the configuration file, take a backup of the file.

2. Add the following line above “/* That’s all, stop editing! Happy blogging. */:”.

===
define(‘WP_ALLOW_MULTISITE’, true);
===

Now the code should look like the one given below.

====
define(‘WP_DEBUG’, false);
define(‘WP_ALLOW_MULTISITE’, true);
/* That’s all, stop editing! Happy blogging. */
====

3. This will enable the “Network Setup” link to appear in WordPress Tools menu. Go to “Administration > Tools > Network Setup” to configure network setup.

In the following page, fill the required details according to your requirement. Ensure that the settings are correct and click Install.

4. Now back up your existing wp-config.php and .htaccess files

5. Create a blogs.dir directory under /wp-content/. This directory is used to store uploaded media for your additional sites and must be writable by the web server. They should have the same permission and ownership as of your wp-content directory.

6. Modifying the configuration:

Once you click Install (Steps 3), a new screen will appear, giving instructions to add lines to your wp-config.php and .htaccess files. These lines are generated based on your configuration.

As per the instruction, add the auto generated lines to the “wp-config.php” file.

7. Add the auto generated mod_rewrite rules to the .htaccess file, replacing other WordPress rules.

If there is no such file, then create one with required permissions and ownership. These rules are generated based on your configuration.

8. Once the above steps are completed and the new wp-config.php & .htaccess files are saved, your network is enabled and configured. You will have to log in again.

9. Now click the down arrow near admin on the right corner of the page & click on Network admin.

10. In the following page, you will see the options to create new site.

Now start creating new sites and users!!!!!.

 

How to install Cpanel Proxy

CPANEL and WHM usually uses  non-common port which can be blocked by local network policy.
CPANEL (non-https) uses port 2082, WHM uses port 2087, and webmail uses port 2095.

There is no perfect solution for this , but by installing cpanel proxy we can find a temporary solution.

Here’s how to install cPanel Proxy on your server :

 

#cd /usr/local/src
#wget http://cpanelproxy.net/cPanelProxy.zip
#mkdir cpanelproxy
#cd cpanelproxy
#unzip ../cPanelProxy.zip
#cd ..
#chown nobody.nobody cpanelproxy -R
#chmod 755 cpanelproxy -R
#mv cpanelproxy /usr/local/share

The next step is to make a few changes to the Apache (web server) configuration file.

vi /usr/local/apache/conf/httpd.conf

 

Scroll right down to the bottom of the file, and add the following lines:

<VirtualHost x.x.x.x> ServerName cpanel.* ServerAlias cpanel.* whm.* webmail.* DocumentRoot /usr/local/share/cpanelproxy </VirtualHost>

Replace x.x.x.x with all the IP addresses that are configured on the server.

To enable the changes, we just need to restart Apache with the following command:

service httpd restart

Enabling cPanel Proxy Existing Accounts :


For this we need to make some changes to DNS. For existing domains, few CNAME records need to be added to each domains zone file. This can be done either through WHM, or via the command line.

Through WHM this can be done in the following ways:

1. Login to WHM

2. Click ‘Edit a DNS Zone’ from the ‘DNS Functions’ menu on the left

3. Select the domain you wish to edit from the list, then click the ‘Edit’ button.

Scroll the page to the point where it says ‘Add New Entries Below this Line’, and add the following two entries into the relevant boxes on the screen:

 

cpanel 14400 IN CNAME yourdomain.com.
webmail 14400 IN CNAME yourdomain.com.

If you also want to add in a link to WHM, you can also add the following entry:

whm 14400 IN CNAME yourdomain.com.

Once your done, click the ‘Save’ button to complete your changes.

Via the command line you can make these changes in the following way, from your SSH session, type the following command to edit the zone file directly:

vi /var/named/yourdomain.com.db 

Scroll to the end of the file, and add the following lines:

cpanel 14400 IN CNAME yourdomain.com. webmail 14400 IN CNAME yourdomain.com.

As mentioned previously, if you also want to add in a link to WHM, you can also add the following entry:

whm 14400 IN CNAME yourdomain.com.

You will be now able to open your web browser to http://cpanel.yourdomain.com/ and be correctly prompted for your username and password.

Setting Forwarder For Outgoing Email For a Domain

To set a forwarder for all outgoing emails  from a particular domain to an email address, follow the steps given below.

Note:- This is only tested on cPanel11 Server.

1. Take the file /etc/cpanel_exim_system_filter in any of your favorite editor like pico, vim etc
2. Append the following contents to the file /etc/cpanel_exim_system_filter.

if      (
$received_protocol is “local”          or
$received_protocol is “esmtpa”         or
$received_protocol is “smtp”
) and (
$header_from contains “@domainname.com” )
then
unseen deliver username@domainname.com
endif

If you don’t want to forward emails from a  particular email address, you can append the following snippet in the /etc/cpanel_exim_system_filter.

if      (
$received_protocol is “local”          or
$received_protocol is “esmtpa”         or
$received_protocol is “smtp”
) and (
$sender_address is not “username_escape@domainname.com” )
and (
$header_from contains “@domainname.com” )
then
unseen deliver username@domainname.com
endif

3. Replace the following

domainname.com with the actual domain
username_escape@domainname.com with email address that you don’t want to forward
username@domainname.com with the email address to which you want to forward.

4. Save the file and then quit.
5. Restart Exim using the following command.

/scripts/restartsrv_exim or
/etc/init.d/exim restart

6. Test it by sending any email from the domain and then check the logs.

 

Enable quota in the server

If quotas are not enabled for the partition, the following error will occur while doing a quotacheck in the server. In case of Cpanel server, /scripts/initquotas will throw the following error.

/scripts/initquotas
Quotas are now on
Updating Quota Files……
quotacheck: Can’t find filesystem to check or filesystem not mounted with quota option.
quotacheck: Can’t find filesystem to check or filesystem not mounted with quota option.
….Done

You need  to follow the steps given below:

$ touch /quota.user /quota.group
$ chmod 600 /quota.*
$ mount -o remount /
$ quotaoff -a
$ vi /etc/fstab
( open ‘fstab’ file and add usrquota,grpquota to the partition where you want to have quota on. That is, for example, add the entry like:
/dev/ubd0 / ext3 defaults,noatime,usrquota,grpquota 1 0 )
$ quotaon -a

Then you can execute the script successfully without any errors. You can run a quotacheck in the server. In Cpanel server, you can run
initquotas without any errors.

 

How to enable viewing HTML content in Horde.

By default it is not possible for us to view the emails in HTML format using Horde webmail interface. All the html content will be displayed at the top of the page and will be requested to download.

To fix this issue, you have to enable “Inline HTML message viewing” for Horde in the server.

To enable “Inline html message viewing” you can perform the following steps:

 1. Goto the horde imp configuration folder at /usr/local/cpanel/base/horde/imp/config2. Edit the file mime_drivers.php using your favorite editor.3. Change the following line
————————————————————
$mime_drivers[‘imp’][‘plain’][‘inline’] = false;
————————————————————

To

————————————————————
$mime_drivers[‘imp’][‘plain’][‘inline’] = true;
————————————————————

4. Restart the cpanel service in the server.

Now you will be able to view the html content using Horde webmail interface.

 

Round Cube Installation

Remove the previous traces of Roundcube in the server.

====================
cd /usr/local/cpanel/base
rm -rf roundcube*
mysql
mysql>drop database roundcube;
====================

Before starting the installation, you need to know the root password of Mysql

====================
cd /usr/local/cpanel/base
wget http://easynews.dl.sourceforge.net/sourceforge/roundcubemail/roundcubemail-0.1beta2.1.tar.gz
tar -zxvf roundcubemail-0.1beta2.1.tar.gz
mv -f roundcubemail-0.1beta2 roundcube
cd roundcube
chmod -R 777 temp
chmod -R 777 logs
====================

Create the database. Find mysql root password from /root/.my.cnf.
Login as user, root.

====================
mysql -u root -p
Password:
mysql>CREATE DATABASE roundcube;
mysql>use roundcube;
mysql>source SQL/mysql.initial.sql;
mysql>quit
====================

Add the configuration:

====================
cd config
mv db.inc.php.dist db.inc.php
mv main.inc.php.dist main.inc.php
====================

Edit the configuration files

====================
using your text editor edit db.inc.php

Find:
$rcmail_config[’db_dsnw’] = ‘mysql://roundcube:pass@localhost/roundcubemail’;
Replace with:
$rcmail_config[’db_dsnw’] = ‘mysql://root:rootpass@localhost/roundcube’;
#vi main.inc.php
====================

Replace the corresponding root password

====================
Find:
$rcmail_config[’default_host’] = ”;
Replace with:
$rcmail_config[’default_host’] = ‘localhost’;
====================

Configure cPanel to show roundcube in the theme. X theme(default) only!!

====================
cd /usr/local/cpanel/base/roundcube/skins/default/images/
cp roundcube_logo.png /usr/local/cpanel/base/frontend/x/images/roundcube_logo.png
cp roundcube_logo.png /usr/local/cpanel/base/webmail/x/images/roundcube_logo.png
wget http://www.yourserverguide.com/Files/HGpatch-roundcube-1.0BETA2.1
patch -p0 < HGpatch-roundcube-1.0BETA2.1
====================

If you receive a message stating: Reversed (or previously applied) patch detected! Assume -R? Please press N for No as this is because you previously installed roundcube

This will auto do all the necessary changes to roundcube and the X theme. Once the patch is executed you may now access roundcube via http://yourdomain/webmail

 

How to disable the the stats services(Analog or Awstats or Webalizer stats) in a cpanel server via backend.

You can disable Analog or Awstats or Webalizer stats in a cpanel server via backend by editing the file “/var/cpanel/cpanel.config”.

1.Check for the variables skipanalog, skipawstats, skipwebalizer in the file and change the values  of the variables to one. Now the variables should look like as follows:

   skipanalog=1
skipawstats=1
skipwebalizer=1

Save the changes and restart the cpanel service in the server.

/etc/init.d/cpanel restart

Now the all the three stats will be disabled server wide.

 

Script to transfer an restore mass cPanel accounts.

cPanel Data transfer.

*** Before performing the account transfer, please setup the servers to ‘SSH without password’ ***

The below given is the script to transfer.

  # vi transfer_accounts.sh#!/bin/bash

for i in `cat /etc/trueuserdomains | awk -F: ‘{print $2}’`
do
/bin/echo “$i”
/scripts/pkgacct $i
file=$(ls /home/cpmove*$i*)
/bin/echo “$file”
scp -P PORT $file root@IP:/root
wait
ls -lh $file
rm -rf $file
done

Change the PORT  and IP address accordingly.
PORT : SSH port of destination server
IP: The IP address of the destination server.

cPanel Data restoration.

The script is given below. Move to the location whether the cpmove files are located and then execute the following.

# ls cpmove-*.tar.gz  | awk -F- ‘{print $2}’ | awk -F. ‘{print $1}’ > file
# for i in `cat file`; do /scripts/restorepkg $i; done

Packages not being displayed in Reseller WHM after transfer

1. Check if the packages are displayed under Create Account option in Reseller WHM.2, If so check the package names : they should be prefixed with its owner name ‘user_'(Reseller account name).3. If the username prefix is missing, it will not be available for editing or deleting in reseller WHM.

E.g: For a package ‘testpack’ under the reseller ‘new’.

The package name should be displayed as ‘new_testpack’.

4. If not, rename the package from the command line, prefixed with corresponding usernames.

mv /var/cpanel/packages/testpack  /var/cpanel/packages/new_testpack

Then the package will become available for editing and deleting in Reseller WHM.


After this, all the accounts under the modified packages or plans should be updated with the new package name.