Login fails to Roundcube, Horde, Squirrel in Webmail

Do the solution steps as mentioned here for the following error you see in Roundcube, Horde and Squirrel mails after successfully logging in webmail.

====
Login failed because your username or password was entered incorrectly
====


#First check the domain name is there in files /etc/localdomains or /etc/remotedomains depends on its local or remote mail exchanger.

#Check the domain’s name is present in /etc/userdomains, if not run script /scripts/updateuserdomains

#Make sure the server hostname is not same as the name of problematic domain name, which would create unexpected authentication issues.
for eg: if your main domain name is test123.com then the hostname should not be the same main domain name, add a new subdomain entry like server.test123.com or host.test123.com etc

Finally you can make sure the entries in /etc/hosts are correct, especially the localhost associated with loop ip 127.0.0.1

A default hosts will look like as follows.

————

# cat /etc/hosts
# that require network functionality will fail.
# Do not remove the following line, or various programs
127.0.0.1        localhost
192.168.5.5        server.host.com server

————-

((((replace 192.168.5.5 with original server main IP and server.host.com with original server hostname))))

After correcting all the above, you will be able to login into Roundcube, Horde, Squirrel successfully.

Proper Method To Change Default Mysql Engine Permanently

Here the mysql engine is set to InnoDB by default and I want to change it to MyISAM for long run. It was the old way setting parameter “skip-innodb” and commenting “innodb_file_per_table=1” in my.cnf file. Additionally we used to execute mysql query “SET storage_engine=MYISAM;”. Now a days, the above changes wont work and perhaps the mysql server doesn’t come back after initiating a restart since the changes made. The proper method is set the variable “default-storage-engine = MyISAM” like my mysql configuration as follows:


<> ~> cat /etc/my.cnf
[mysqld]
skip-innodb
#innodb_file_per_table=1
default-storage-engine = MyISAM
#innodb_force_recovery = 4

Nothing else you need to do 🙂
Now restart mysql server and check the default engine is set to what


<> ~> /etc/init.d/mysql restart
Shutting down MySQL. [ OK ]
Starting MySQL. [ OK ]


mysql> show engines;
+——————–+———+—————————————————————-+————–+——+————+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+——————–+———+—————————————————————-+————–+——+————+
| MyISAM | DEFAULT | MyISAM storage engine | NO | NO | NO |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |
| ARCHIVE | YES | Archive storage engine | NO | NO | NO |
| FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL |
| InnoDB | NO | Supports transactions, row-level locking, and foreign keys | NULL | NULL | NULL |
+——————–+———+—————————————————————-+————–+——+————+
9 rows in set (0.00 sec)

If you want to enable InnoDB as well along with default MyISAM engine, then comment out the variable skip-innodb and remove comment before variable innodb_file_per_table=1

Import mails from a non cPanel server

It’s easy for us to import emails over between two cPanel servers, no matter we are migrating 50 or 100 accounts or so, its an easy job to do via WHM or even via backend of cPanel servers. But what if your task to migrate over all emails from a non cPanel server. aahh now you are in trouble!!! 😛

But trust me, you can do that easily with “imapsync”. Following is the command that I did to import mails of email account from a non cpanel.

suppose you want to migrate userx account on server sourceserver.com to userx account on destinationserver.com

====
imapsync –host1 sourceserver.com –user1 userx@domain.net –password1 enterpasshere –host2 destinationserver.com –user2 userx@domain.net –password2 enterpasshere –regexflag “s/\Forwarded//g” –noauthmd5 –syncinternaldates
====

you will see lot of things going on as below in the screen which is a sync process betweeen the two mail servers, wait for a while to complete and then you are done.

============
msg INBOX/208 {34910} copied to INBOX/445
msg INBOX/209 {81261} copied to INBOX/446
msg INBOX/210 {77615} copied to INBOX/447
msg INBOX/211 {10423} copied to INBOX/448
msg INBOX/212 {7092} copied to INBOX/449
msg INBOX/213 {13977} copied to INBOX/450
msg INBOX/214 {57403} copied to INBOX/451
msg INBOX/215 {75258} copied to INBOX/452
msg INBOX/216 {54282} copied to INBOX/453
msg INBOX/217 {77174} copied to INBOX/454
msg INBOX/218 {3298} copied to INBOX/455
msg INBOX/219 {48916} copied to INBOX/456
msg INBOX/220 {19315} copied to INBOX/457
[INBOX.Drafts] -> [INBOX.Drafts]
[INBOX.Junk] -> [INBOX.Junk]
[INBOX.Sent] -> [INBOX.Sent]
[INBOX.Trash] -> [INBOX.Trash]
++++ End looping on each folder
++++ Statistics
Transfer started on : Fri Nov 1 15:47:37 2013
Transfer ended on : Fri Nov 1 15:48:19 2013
Transfer time : 42 sec
Messages transferred : 232
Messages skipped : 0
Messages found duplicate on host1 : 0
Messages found duplicate on host2 : 0
Messages void (noheader) on host1 : 0
Messages void (noheader) on host2 : 0
Messages deleted on host1 : 0
Messages deleted on host2 : 0
Total bytes transferred : 16188117
Total bytes duplicate host1 : 0
Total bytes duplicate host2 : 0
Total bytes skipped : 0
Total bytes error : 0
Message rate : 5.5 messages/s
Average bandwidth rate : 376.4 KiB/s
Reconnections to host1 : 0
Reconnections to host2 : 0
Memory consumption : 115.4 MB
Biggest message : 3019767 bytes
Memory/biggest message ratio : 40.1
Detected 0 errors
============

Before everything you need to ensure imapsync is installed in server. If not just install it using yum.

=====
yum install imapsync
=====

You may require the following perl modules to install in the server.

=====
Mail::IMAPClient 3.34
IO::Socket 1.31
IO::Socket::INET 1.31
IO::Socket::SSL 1.955
Digest::MD5 2.53
Digest::HMAC_MD5 1.01
Term::ReadKey 2.30
Authen::NTLM 1.09
=====

For their installation, just go to cpan prompt and install them one by one.
For eg:

=====
[~]# cpan
cpan> install Mail::IMAPClient
=====

Please note if you are trying to import mails from pop accounts, them imapsync may not work. Such cases you can refer to poptoimap tool. Please read these:

http://www.linux-france.org/prj/pop2imap/pop2imap
http://imapsync.lamiral.info/FAQ

PHP 5.4 : Strict standards : Non-static methods called statically

I got the following error while loading up a domain running on php 5.4

=======================
Strict Standards: Non-static method JLoader::import() should not be called statically in /home/user/public_html/libraries/joomla/import.php on line 29
Strict Standards: Non-static method JLoader::register() should not be called statically in /home/user/public_html/libraries/joomla/loader.php on line 71
Strict Standards: Non-static method JLoader::import() should not be called statically in /home/user/public_html/libraries/joomla/import.php on line 32
=======================

and I did the below steps to clear them

=======================
In php.ini,
changed error_reporting = E_ALL | E_STRICT to error_reporting = E_ALL & ~E_NOTICE

changed display_errors = On to display_errors = Off
=======================

If the above still doesn’t help you, do the following too.

In the domains index.php file set it like inside the php division.

========
ini_set(‘display_errors’,0);
========

This should fix it 🙂

Legacy filter_module syntax causing 500 error in apache 2.4

Hey, sometimes you may come up with the following error in error log which is actually causing by legacy filter_module syntax on the htaccess file.


======================
[Sun Oct 06 18:20:24.119633 2013] [core:alert] [pid 47884] [client 5.x.x.x:54039] /home/user/public_html/.htaccess: FilterProvider takes three arguments, filter-name provider-name match-expression
[Sun Oct 06 18:20:31.705923 2013] [core:alert] [pid 48315] [client 157.x.x.x:46020] /home/user/public_html/.htaccess: FilterProvider takes three arguments, filter-name provider-name match-expression
[Sun Oct 06 18:20:31.707094 2013] [core:alert] [pid 48315] [client 157.x.x.x:46020] /home/user/public_html/.htaccess: FilterProvider takes three arguments, filter-name provider-name match-expression
======================

Probably the apache version is 2.4 in your server and it wont take the legacy filter_module syntax. You should need to make some changes in it. For example my users filter_module rules were as follows in his .htaccess file.


FilterDeclare COMPRESS
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/html
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/css
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/plain
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $text/x-component
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/javascript
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/json
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/xhtml+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/rss+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/atom+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/vnd.ms-fontobject
FilterProvider COMPRESS DEFLATE resp=Content-Type $image/svg+xml
FilterProvider COMPRESS DEFLATE resp=Content-Type $image/x-icon
FilterProvider COMPRESS DEFLATE resp=Content-Type $application/x-font-ttf
FilterProvider COMPRESS DEFLATE resp=Content-Type $font/opentype
FilterChain COMPRESS
FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no

I changed it to


FilterDeclare COMPRESS
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'text/html'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'text/css'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'text/plain'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'text/xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'text/x-component'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/javascript'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/json'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/xhtml+xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/rss+xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/atom+xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/vnd.ms-fontobject'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'image/svg+xml'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'image/x-icon'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'application/x-font-ttf'"
FilterProvider COMPRESS DEFLATE "%{Content_Type} = 'font/opentype'"
FilterChain COMPRESS
FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no

The error has gone then 🙂

Trim down load in server without killing your current running process.

It’s a fact that while we initiate some cpu or memory consumable process or job, the load in server goes high and sometimes the server become unresponsive. But what if the situation is same everytime especially in case of shared servers. The processess like pkgacct, copying, moving high sized files/folders can’t be ignored at the event of migration or other instances etc. Suppose if we initiate a pkgacct of one account and certainly the load goes high in server, so we may need to cut the pkgacct process we initiated for reducing the load. We can’t always do this whenever server load goes high, because it must be a real headache to initiate, cut, reinitiate etc process manually whenever the load varies in server.

You can do this task with the help of cpuwatch in cPanel servers. Just do the following.

=====
/usr/local/cpanel/bin/cpuwatch 3 /scripts/pkgacct cPanelusername
=====

In the above, whenever the load goes high over 3, the process “/scripts/pkgacct cPanelusername” pauses automatically and resumes as well when the load reduce under 3.

Apachebooster – For speedy webserver

ApacheBooster is a integration of nginx and varnish, this Plugin will reduce the server load spike and memory usage. Also the plugin will provide the maximum performance of your websites.

Varnish

Varnish Cache is a web application accelerator also known as a caching HTTP reverse proxy. You install it in front of any server that speaks HTTP and configure it to cache the contents. Varnish Cache is really, really fast. It typically speeds up delivery with a factor of 300 – 1000x, depending on your architecture. A high level overview of what Varnish does can be seen in the video attached to this web. Varnish performs really, really well. It is usually bound by the speed of the network, effectivly turning performance into a non-issue. We’ve seen Varnish delivering 20 Gbps on regular off-the-shelf hardware.

Nginx

Nginx is known for its high performance, stability, rich feature set, simple configuration, and low resource consumption.

Unlike traditional servers, Nginx doesn’t rely on threads to handle requests. Instead it uses a much more scalable event-driven (asynchronous) architecture. This architecture uses small, but more importantly, predictable amounts of memory under load.

Features:

* cPanel WHM Integration
* Varnish Advanced Configuration
* Opt-out Domain List Served Directly by Apache
* VCL Script Compatibility

Installation Details

ApacheBooster Install instruction

wget http://prajith.in/downloads/apachebooster.tar.gz

tar -zxf apachebooster.tar.gz

cd apachebooster

sh install.sh

ApacheBooster Uninstall instruction

wget http://prajith.in/downloads/apachebooster.tar.gz

tar -zxf apachebooster.tar.gz

cd apachebooster

sh uninstall

cPanel Internal PHP or 3rd party PHP is not working.

I came into an issue like I was not able to install softaculous in server since the 3rd party php in cPanel was broken. The cPanel version in server was 11.36. The following has had no output.

========
# /usr/local/cpanel/3rdparty/bin/php -v
#
========

Unfortunately there is not script “/scripts/makecpphp” available on cPanel latest verion 11.36, there is entirely a different method to correct internal php issue in new cPanel.

The issue here was the RPMs for PHP were broken, along with a few other applications, and had to be reinstalled. I did it in the following way.
========
# /scripts/check_cpanel_rpms
[20130509.121247]
[20130509.121247] Problems were detected with cPanel-provided files which are RPM
controlled.
[20130509.121247] If you did not make these changes intentionally, you can correct
them by running:
[20130509.121247]
[20130509.121247]> /usr/local/cpanel/scripts/check_cpanel_rpms –fix
[20130509.121247]
[20130509.121247] The following files were found to be altered from their original
RPM:
[20130509.121247] bandmin,1.6.1,9.cp1136
[20130509.121247] cpanel-cairo,1.8.10,1.cp1136
[20130509.121247] cpanel-fontconfig,2.8.0,1.cp1136
[20130509.121247] cpanel-freetype,2.4.10,1.cp1136
[20130509.121247] cpanel-perl-514-Cpanel-TaskQueue,0.307,3.cp1136
[20130509.121247] cpanel-php53,5.3.17,5.cp1136
[20130509.121247] cpanel-php53-SOAP,0.13.0,1.cp1136
[20130509.121247] cpanel-pixman,0.24.2,1.cp1136
[20130509.121247] cpanel-rrdtool,1.4.7,1.cp1136
[20130509.121247] cpanel-wwwcount,2.5,2.cp1136
[20130509.121247]
Do you want to repair these RPMs?(y/n): y

You should be good to go at this time.
========

The issue has been resolved.

========
# /usr/local/cpanel/3rdparty/bin/php -v
PHP 5.3.17 (cli) (built: Apr 12 2013 10:47:19)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
with the ionCube PHP Loader v4.2.2, Copyright (c) 2002-2012, by ionCube Ltd.
========

Disable Recursive DNS in cPanel server.

Edit the /etc/named.conf file
After the “CONTROLS” section, add the following:

acl “trusted” {
127.0.0.1;
YOUR IP 1;
YOUR IP2;
};

options {
directory “/var/named”;
version “not currently available”;
allow-recursion { trusted; };
allow-notify { trusted; };
allow-transfer { trusted; };
dump-file “data/cache_dump.db”;
statistics-file “data/named_stats.txt”;
memstatistics-file “data/named_mem_stats.txt”;

};

Remove the other “OPTIONS” section in your named.conf file.

You can check the named conf sysntax using the following command.

# named-checkconf /etc/named.conf

Then

#rndc reload

#/etc/init.d/named restart