Latest visitor logs not working in cpanel

Sometimes theΒ latest visitors stats is not showing in the cpanel, to resolve the issue, you can use the following steps.

Try to change WHM \ Tweak Security \ “Delete each domain’s access logs after stats run” from ON to OFF.


It’s possible the the latest visitors cache is corrupted for this account. Try using the following command to move the existing cache out of the way so it can be regenerated:

# mv /home/username/.cpanel/nvdata/latest_visitors /home/username/.cpanel/nvdata/latest_visitors_old

Replace “username” with the username of the account.

WordPress error Download failed.: Failed writing body

While upgrading wordpress, or installing/upgrading any theme or plugin, you may get following error in the admin panel.

Download failed. Failed writing body (66 != 1448)

Most probably, you are out of disk space so its good to check the disk usage in cpanel or on shell and delete unwanted files or upgrade the disk space.

Once the disk space is upgraded, try to upgrade again.

It should work. πŸ™‚

“cPanel & WHM Update Blocks” error on the main page of WHM when we login to WHM

This issue is caused due to expired cpanel license or the corrupted license file.

It can be resolved by moving /var/cpanel/update_blocks.config and resynchronizing the cPanel license with /usr/local/cpanel/cpkeyclt.

# mv /var/cpanel/update_blocks.config /var/cpanel/update_blocks.config.bk

# /usr/local/cpanel/cpkeyclt

If its still the same, try to disable the CSF firewall by

# csf -x

and then resynchronizing the cPanel license.

database error for horde and roundecube

Sometimes you may face the following errors in webmail.

horde : A fatal error has occurredDB Error: connect failed

roundcube: DATABASE ERROR: CONNECTION FAILED!Unable to connect to the database!

Most probably, its an issue with the databases associated with horde and roundcube, so please check related error logs by

# vi /var/cpanel/horde/log/horde_0.log

Press Shift+G and check the error at bottom.

Feb 27 03:16:06 HORDE [emergency] [horde] DB Error: connect failed: Β [nativecode=Access denied for user ‘horde’@’localhost’ (using password: YES)] ** mysql(mysql)://horde:[email protected]+localhost:3306/horde?persistent=1&charset=utf-8&ssl=1&splitread= [pid 18142 on line 398 of “/usr/local/cpanel/base/horde/lib/Horde/Perms/sql.php”]

# vi /var/cpanel/roundcube/log/errors

Press Shift+G and check the error at bottom.

[27-Feb-2012 03:15:09 +0000]: DB Error: _doConnect: [Error message: Access denied for user ’roundcube’@’localhost’ (using password: YES)]
[Native code: 1045]
[Native message: Access denied for user ’roundcube’@’localhost’ (using password: YES)]
** mysql(mysql)://roundcube:[email protected]/roundcube in /usr/local/cpanel/base/3rdparty/roundcube/program/include/rcube_mdb2.php on line 102 (GET /cpsess7853727673/3rdparty/roundcube/index.php)

The issue can be resolved by forced update

# /usr/local/cpanel/bin/update-horde –force
# /usr/local/cpanel/bin/update-roundcube –force

Once update completed, check the webmail.

You are done!

How to check if suexec enabled or not

You can use following steps to check the server for suexec

1) Login into you server as root and fire following command

#/usr/local/cpanel/bin/rebuild_phpconf --current

If server is Suexec then result would look like


PHP4 SAPI: suphp

PHP5 SAPI: suphp

SUEXEC: enabled

2) If you are not sure about Shell then you can also check the SuExec is enabled or not? from your WHM.Lgin into your WHM and in the menu find Configure PHP and SuExec

Check the drop down box for “PHP 4/5 Handler” – and if beside that it says “suPHP” – Then your sever is SuExec enabled

3) If you don’t have root access, you can create a php file (test.php) in your account from cPanel >> File Manager and change the permissions on that file to 777 and open it in a browser. If it gives 500 Internal Server Error, your most probably running suPHP.

4)As well as you can also create the phpinfo page in your account from your cPanel >> File manager For ex. phpinfo.php with the following code;

<? phpinfo() ?>

After creating phpinfo.php page browse it and if it shows

Server API = Apache then server is not running PHP in Suexec mode

And if

Server API = CGI the server is running PHP in Suexec mode.

Yum installation on a cPanel VPS

The OS template used for a cPanel VPS doesn’t include yum, you need to install it manually.

You can install Yum on Linux centOS 5.x 32 Bit server by installing following RPMS.

# rpm -ivh

# rpm -ivh

# rpm -ivh

# rpm -ivh

# rpm -ivh

# rpm -ivh

# rpm -ivh

# rpm -ivh –nodeps

# rpm -ivh

After all RPMs installd, run

# yum update

That’s it!

The skeleton directory in a cPanel server

The skeleton directory, is a feature available in Web Host Manager (WHM), the control panel that comes with reseller account on cPanel servers. This directory is used as a template, or skeleton, for new cPanel accounts. Anything placed in the skeleton directory of the reseller account is automatically copied to the home directory of any new cPanel account created by that reseller.

For example if, in the skeleton directory, you create a /public_html directory include an index.html file, each new cPanel account you create will have a copy of that index.html in their public_html directory.

To know your skeleton directory path:

Login to WHM

In the Account Functions menu, click on the β€œSkeleton Directory” link.

The path to your skeleton directory will be displayed, usually its something like,


where β€œusername” is your main reseller account.

You could put information telling your clients how to begin modifying their cPanel account settings, uploading their own web pages, etc. Or in an index.php file, you could include more dynamic contents. Or you can welcome your clients by putting welcome texts or can put heading like that ******* site is proudly hosted by ********. Some include a page with steps for clients on how to begin configuring their accounts.

So when your client opens the website, he will see a default index page ie the page placed in skeleton directory. its good feature to add a default index page so that there will not be directory listing show for newly created accounts.

Enable slow query log in a cPanel/Linux server

To enable slow query log in cpanel server, you can use following steps.

Add following to following to /etc/my.cnf file on server.

# vi /etc/my.cnf


After that, do the following commands to create the file with the right ownership and file permissions

# touch /var/lib/mysql/slow.log

# chmod 660 /var/lib/mysql/slow.log

# chown mysql:mysql /var/lib/mysql/slow.log

Restart the mysql server and check the logs in /var/lib/mysql/slow.log.

How to optimize the MySQL using scripts

To optimize the mysql, you can use either of the scripts provided below.

The first one is MysqlTuner

The MysqlTuner is a Perl script that analyzes your MySQL performance and, based on the statistics it gathers, gives recommendations which variables you should adjust in order to increase performance. That way, you can tune your my.cnf file to tease out the last bit of performance from your MySQL server and make it work more efficiently.

You can download the MySQLTuner script by

# wget

# chmod 755

Once you make the .pl script executable

# ./

It will show output as below (its sample output)

>> MySQLTuner 1.0.0 – Major Hayden

>> Bug reports, feature requests, and downloads at

>> Run with β€˜β€“help’ for additional options and output filtering

——– General Statistics ————————————————–

[–] Skipped version check for MySQLTuner script

[OK] Currently running supported MySQL version 5.0.81-community

[!!] Switch to 64-bit OS – MySQL cannot currently use all of your RAM

——– Storage Engine Statistics β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”-

[–] Status: +Archive -BDB -Federated +InnoDB -ISAM -NDBCluster

[–] Data in MyISAM tables: 374M (Tables: 3987)

[–] Data in InnoDB tables: 3M (Tables: 98)

[–] Data in MEMORY tables: 0B (Tables: 2)

[!!] Total fragmented tables: 201

——– Performance Metrics β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”-

[–] Up for: 14d 0h 24m 52s (12M q [10.043 qps], 491K conn, TX: 3B, RX: 1B)

[–] Reads / Writes: 86% / 14%

[–] Total buffers: 442.0M global + 12.3M per thread (100 max threads)

[OK] Maximum possible memory usage: 1.6G (41% of installed RAM)

[OK] Slow queries: 0% (91/12M)

[!!] Highest connection usage: 100% (101/100)

[OK] Key buffer size / total MyISAM indexes: 384.0M/111.0M

[OK] Key buffer hit rate: 100.0% (3B cached / 1M reads)

[OK] Query cache efficiency: 75.8% (7M cached / 9M selects)

[!!] Query cache prunes per day: 33741

[OK] Sorts requiring temporary tables: 0% (1 temp sorts / 1M sorts)

[!!] Joins performed without indexes: 53627

[!!] Temporary tables created on disk: 35% (587K on disk / 1M total)

[OK] Thread cache hit rate: 99% (2K created / 491K connections)

[!!] Table cache hit rate: 1% (512 open / 38K opened)

[OK] Open file limit used: 24% (1K/4K)

[OK] Table locks acquired immediately: 99% (3M immediate / 3M locks)

[OK] InnoDB data size / buffer pool: 3.7M/8.0M

——– Recommendations —————————————————–

General recommendations:

Run OPTIMIZE TABLE to defragment tables for better performance

Enable the slow query log to troubleshoot bad queries

Reduce or eliminate persistent connections to reduce connection usage

Adjust your join queries to always utilize indexes

When making adjustments, make tmp_table_size/max_heap_table_size equal

Reduce your SELECT DISTINCT queries without LIMIT clauses

Increase table_cache gradually to avoid file descriptor limits

Variables to adjust:

max_connections (> 100)

wait_timeout (< 28800)

interactive_timeout (< 28800) query_cache_size (> 32M)

join_buffer_size (> 128.0K, or always use indexes with joins)

tmp_table_size (> 32M)

max_heap_table_size (> 16M)

table_cache (> 512)

Check the “Recommendations” and edit the my.cnf accordingly.

You can use another script as below.

Its MySQL Performance Tuning Primer Script which can be downloadd from

# wget

# chmod 755

# ./

It will provide sample output as below.


– By: Matthew Montgomery –

MySQL Version 5.0.81-community i686

Uptime = 30 days 0 hrs 20 min 55 sec

Avg. qps = 10

Total Questions = 12160398

Threads Connected = 3

Server has been running for over 65hrs.

It should be safe to follow these recommendations

To find out more information on how each of these

runtime variables effects performance visit:


for info about MySQL’s Enterprise Monitoring and Advisory Service


The slow query log is NOT enabled.

Current long_query_time = 10 sec.

You have 90 out of 12160419 that take longer than 10 sec. to complete

Your long_query_time may be too high, I typically set this under 5 sec.


The binary update log is NOT enabled.

You will not be able to do point in time recovery



Current thread_cache_size = 8

Current threads_cached = 5

Current threads_per_sec = 0

Historic threads_per_sec = 0

Your thread_cache_size is fine


Current max_connections = 100

Current threads_connected = 3

Historic max_used_connections = 101

The number of used connections is 101% of the configured maximum.

You should raise max_connections


Max Memory Ever Allocated : 1.63 G

Configured Max Per-thread Buffers : 1.20 G

Configured Max Global Buffers : 426 M

Configured Max Memory Limit : 1.61 G

Physical Memory : 3.96 G

Max memory limit seem to be within acceptable norms


Current MyISAM index space = 108 M

Current key_buffer_size = 384 M

Key cache miss rate is 1 : 3157

Key buffer free ratio = 85 %

Your key_buffer_size seems to be fine


Query cache is enabled

Current query_cache_size = 32 M

Current query_cache_used = 18 M

Current query_cache_limit = 1 M

Current Query cache Memory fill ratio = 59.10 %

Current query_cache_min_res_unit = 4 K

MySQL won’t cache query results that are larger than query_cache_limit in size


Current sort_buffer_size = 2 M

Current read_rnd_buffer_size = 8 M

Sort buffer seems to be fine


Current join_buffer_size = 132.00 K

You have had 53627 queries where a join could not use an index properly

You should enable β€œlog-queries-not-using-indexes”

Then look for non indexed joins in the slow query log.

If you are unable to optimize your queries you may want to increase your

join_buffer_size to accommodate larger joins in one pass.

Note! This script will still suggest raising the join_buffer_size when

ANY joins not using indexes are found.


Current open_files_limit = 4096 files

The open_files_limit should typically be set to at least 2x-3x

that of table_cache if you have heavy MyISAM usage.

Your open_files_limit value seems to be fine


Current table_cache value = 512 tables

You have a total of 4104 tables

You have 512 open tables.

Current table_cache hit rate is 1%, while 100% of your table cache is in use

You should probably increase your table_cache


Current max_heap_table_size = 16 M

Current tmp_table_size = 32 M

Of 1081722 temp tables, 35% were created on disk

Effective in-memory tmp_table_size is limited to max_heap_table_size.

Perhaps you should increase your tmp_table_size and/or max_heap_table_size

to reduce the number of disk-based temporary tables

Note! BLOB and TEXT columns are not allow in memory tables.

If you are using these columns raising these values might not impact your

ratio of on disk temp tables.


Current read_buffer_size = 2 M

Current table scan ratio = 1537 : 1

read_buffer_size seems to be fine


Current Lock Wait ratio = 1 : 1545

You may benefit from selective use of InnoDB.

If you have long running SELECT’s against MyISAM tables and perform

frequent updates consider setting β€˜low_priority_updates=1′

If you have a high concurrency of inserts.

How to Install mod_pagespeed in a cPanel/Linux server

The mod_pagespeed is an open-source Apache module that automatically optimizes web pages and resources. It does this by rewriting the resources using filters that implement web performance best practices. Webmasters and web developers can use mod_pagespeed to improve the performance of their web pages when serving content with the Apache HTTP Server.

The mod_pagespeed includes several filters that optimizes JavaScript, HTML and CSS stylesheets. It also includes filters for optimizing JPEG and PNG images. The filters are based on a set of best practices known to enhance web page performance. For now the module is compatible with Apache version 2.2 and is now available as a down-loadable binary for i386 and x86-64bit systems.

You can check the wiki here

To install the mod_pagespeed, use steps provided below.

For 32Bit system

# cd /usr/local/src

# mkdir mod_pagespeed

# cd mod_pagespeed

# wget…rrent_i386.rpm

# rpm2cpio mod-pagespeed-beta_current_i386.rpm | cpio -idmv

# cp /usr/local/src/mod_pagespeed/usr/lib/httpd/modules/ /usr/local/apache/modules/

# cp /usr/local/src/mod_pagespeed/etc/httpd/conf.d/pagespeed.conf /usr/local/apache/conf/

# chmod 755 /usr/local/apache/modules/

# mkdir /var/mod_pagespeed/{cache,files} -p

# chown nobody:nobody /var/mod_pagespeed/*

For 64Bit system

# cd /usr/local/src

# mkdir mod_pagespeed

# cd mod_pagespeed

# wget…ent_x86_64.rpm

# rpm2cpio mod-pagespeed-beta_current_x86_64.rpm | cpio -idmv

# cp /usr/local/src/mod_pagespeed/usr/lib64/httpd/modules/ /usr/local/apache/modules/

# cp /usr/local/src/mod_pagespeed/etc/httpd/conf.d/pagespeed.conf /usr/local/apache/conf/

# chmod 755 /usr/local/apache/modules/

# mkdir /var/mod_pagespeed/{cache,files} -p

# chown nobody:nobody /var/mod_pagespeed/*

The mod_pagespeed needs mod_deflate to be loaded in Apache. If it is not yet installed, you can just include the same from apache source by,

# /usr/local/apache/bin/apxs -c -i /home/cpeasyapache/src/httpd-2.2.16/modules/filters/mod_deflate.c

After that, we’ll have to edit the mod_pagespeed configuration file located at /usr/local/apache/conf/pagespeed.conf to reflect the correct paths, the LoadModule directives should fetch the modules in “modules/”

LoadModule pagespeed_module modules/
LoadModule deflate_module modules/
ModPagespeedFileCachePath   "/var/mod_pagespeed/cache/"
ModPagespeedGeneratedFilePrefix   "/var/mod_pagespeed/files/"Β 

And finally, include pagespeed.conf in /usr/local/apache/conf/httpd.conf:

Include β€œconf/pagespeed.conf”

And finally, restart your HTTP server by

# service httpd restart

If everything is fine, apache will start normally and as your domains begin to get hits, you will see data being written in to /var/mod_pagespeed/*. Just a reminder that this module seems to write a lot of data in apache error log. You might need to monitor the server load and i/o stats for some time to ensure that everything is stable.

You can check the mod_pagespeed docs here