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.

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.

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

Perl Module installation in a Linux/cPanel server?

There are various ways to download and install perl modules from CPAN. In general it’s a good idea to download and install the perl module but we will see the different ways of installing the perl module.

1. The easiest way is to use the perl CPAN module. SSH to the server as root and execute:

# cpan

If you are running this for the first time, it will prompt you for a few questions (default answers are fine) before providing you with the “cpan >” prompt. To install a module, say for example “Perl::OSType”, execute

# cpan > install Perl::OSType

this will download and compile the module and install it server wide. To know more commands/options of cpan, type question mark ( ? ) at the cpan prompt.

2. The second and the quickest method is to use perl CPAN module from the bash prompt instead of ‘cpan’ prompt. If you are on the command line of Linux, just execute

# perl -MCPAN -e ‘install Perl::OSType’

3. The above 2 methods are the easiest one but it is recommended to install the module manually as the above methods may not always work. You can search the module at and then wget it on your server. Once done, extract it:

# tar -zxf Perl-OSType-1.002.tar.gz

There is a standard way of installing the perl module, however, you will see a README file inside the extracted directory containing the installation steps. Goto the extracted directory and execute

# perl Makefile.PL

# make

# make test

# make install

Or you can use perl module installer script as well.

It’s simplest to install a perl module from the shell:

# /scripts/perlinstaller module


# /scripts/perlinstaller Inline::C

If you’re not sure of the module name, you can search for it on cpan:

Or you can use Perl Module Installer in WHM;

This WHM feature allows you to download and install a Perl module. It works by providing an interface that lets you search through the central Perl repository known as CPAN ( WHM then returns a list of Perl modules that match your search criteria, allowing you to click on any of the relevant search results to download and install the module.

To search for and install a Perl module:

1. Enter your search criteria into the available text field. Alternatively:

You can also view a list of Perl modules available from CPAN by clicking Show Available Perl Module(s). The list is limited, however; an exhaustive list is available at

If you know the exact name of the module you wish to install, you may install it by entering its name in the Install a Perl Module text box and clicking Install Now.

2. Click Go.

WHM will display the matching Module Name, Version, Description, and any Actions you may perform.

3. Click the Install button next to the module you would like to download and install.

You may also view a module’s documentation by clicking its corresponding Show Docs button.

If you did not find the desired module, you may continue searching from the search results page using the Search field and Go button.

Thats it.

How to install/upgrade roundcube in a cPanel/Linux server

Before installing roundcube on a cPanel server you should know your mysql root password. Replace DATABASEPASSWORD with your mysql root password.

If Roundcube is already installed, you need to uninstall it.

Uninstall/remove exiting RoundCube

# cd /usr/local/cpanel/base

# rm -rf roundcube*

On mysql prompt

mysql -e ‘drop database roundcube’;

# /scripts/upcp

Now follow the  steps to update/install latest roundcube. You will have to specify your root password when prompted.

# cd /usr/local/cpanel/base

# wget -O roundcube.tar.gz

# roundcubemail/roundcubemail-0.2.1.tar.gz

# rm -rf roundcube.tar.gz

# mv -f roundcubemail-0.2.1/ roundcube

# cd roundcube

# chmod -R 777 temp

# chmod -R 777 logs

Database Configuration

Create the database, database user and install the intial sql file. The following commands will do this for you.

mysql -e “CREATE DATABASE roundcube;”

mysql -e “GRANT ALL PRIVILEGES ON roundcube.* TO [email protected] IDENTIFIED BY



mysql -e “use roundcube; source SQL/mysql.initial.sql;”

You will have to replace the roundcube password with ‘DATABASEPASSWORD’ field.

Roundcube Configuration

# cd config

# mv

# mv

then open database configruation file in your favroite editor.

# vi

Find following line

$rcmail_config[‘db_dsnw’] = ‘mysql://roundcube:[email protected]/roundcubemail’;

Replace it with

$rcmail_config[‘db_dsnw’] = ‘mysql://roundcube:[email protected]/roundcube’;

Now Open

# vi


$rcmail_config[‘default_host’] = ”;

Replace with

$rcmail_config[‘default_host’] = ‘localhost’;

Configure cPanel to show roundcube in the theme. Please note this is for the X theme(default) only!! If you use another theme please skip the next part and see below.

# cd /usr/local/cpanel/base/roundcube/skins/default/images/

# cp –reply=yes roundcube_logo.png /usr/local/cpanel/base/frontend/x/images/roundcube_logo.png

# cp –reply=yes roundcube_logo.png /usr/local/cpanel/base/webmail/x/images/roundcube_logo.png

# cd /usr/local/cpanel/base

# wget

# patch -p0 < HGpatch-roundcube-1.0BETA2

# chattr +i /usr/local/cpanel/base/frontend/x3/webmaillogin.html

# chattr +i /usr/local/cpanel/base/webmaillogin.cgi

Restart the mysql, cpanel services on your server. You are done!, have fun with your new Roundcube installation!!

You can access roundcube by

no mysql database size shown in cpanel

You may see the mysql database size is zero in cPanel >> Mysql Databases, though the databases contains tables and data. In order to include the size of the databases while displaying disk usage in cPanel/WHM, use either of the following steps:

1) SSH to your server as root and edit the cpanel.config file

# vi /var/cpanel/cpanel.config

Search for


and change to


If the parameter is not present, add it. Save the file and execute the following command:

# /scripts/update_db_cache

OR You may use follwing option in WHM

2) Login to the WHM, goto Tweak Settings >> ‘SQL’ section and enable the following option:

When displaying disk usage in cpanel/WHM include Postgresql and MySQL.

You are done.

Cpanel error Fantastico is not installed at the default location

While accessing the Fantastico in cpanel, you may encounter following error,

Fantastico is not installed at the default location /usr/local/cpanel/3rdparty/fantastico. Either move the Fantastico directory from it’s current location to /usr/local/cpanel/3rdparty/fantastico OR enable ioncube loaders in WHM -> Tweak settings.

To resolve the issue

Make sure ioncube loader is installed and enabled on server. You can check it in WHM >> Tweal Settings

If its not working,

You need to compile cpanel PHP (not server PHP) by

# /scripts/makecpphp

This updates/compiles the version of PHP that cPanel uses internally. Not the same as the PHP account users use to execute scripts. The internal PHP binary is used for the cPanel installed version of PHPMyAdmin, Horde, Squirrelmail and any other PHP Webapp that is internal to cPanel/WHM.

After cpphp, if its still showing the same error,

Try to update the cpanel installation by,

# /scripts/upcp –force

This should resolve the issue.

phpMyadmin error in a cPanel server

Sometimes you may face following error in phpmyadmin

Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly.

First thing you’ll neet to do is to check the error logs.(Generally its here /usr/local/apache/logs/error_log). You will probably see errors referencing permission errors writing to your session directory.

Just  change the permission of the session directory (chmod 777) you should be good to go.

If no success….

Login in to the Shell with the root user and then open the file using your favorite editor.

# vi /usr/local/cpanel/3rdparty/etc/phpmyadmin/php.ini

Search for session.save_path and change the following
session.save_handler = sqlite
session.save_path = /var/cpanel/userhomes/cpanelphpmyadmin/sessions/
session.save_handler = files
session.save_path = /tmp
Save & Exit
Restart apache

If after upgrade its reverting back, or you don’t want to change the session.save_path in php.ini for phpmyadmin

# mkdir -p /var/cpanel/userhomes/cpanelphpmyadmin/sessions
# chmod 1777 /var/cpanel/userhomes/cpanelphpmyadmin/sessions

and restart the apache service.

You are done !

How to enable allow_url_fopen for a single domain in a cPanel server

The way to enable allow_url_fopen on a phpsuexec and a non-phpsuexec server is different. For security reasons the option is mostly disabled server wide, however, you can turn it ON for a single domain/account if it is required.

Its pretty simple to enable it.

On a non phpsuexec server:

# cd /usr/local/apache/conf/
see if you have a “userdata” directory there? If not, create the “userdata/” directory and then the file allowurl.conf inside it. So the complete path should look like:

# vi /usr/local/apache/conf/userdata//allowurl.conf
and add the following to the file
php_admin_value allow_url_fopen On
php_admin_value allow_url_include On

Now, edit the Apache configuration file and scroll down to the VirtualHost entry of the domain. Include the path of the above created file in it, as shown below:

Include “/usr/local/apache/conf/userdata//allowurl.conf”
Save the file and rebuild the apache configuration by

# /usr/local/cpanel/bin/apache_conf_distiller –update
# /usr/local/cpanel/bin/build_apache_conf
# /scripts/restartsrv httpd
This will enable allow_url_fopen for that domain.

On a PHPSuExec Or SuPHP server:
On a SuPHP enabled server, turning ON allow_url_fopen in the VirtualHost entry won’t work since PHP is not working as a Apache Handler anymore.

In such a case, copy the global php.ini of the server under directory of the domain, say public_html (you need to copy php.ini to the directory, where your script with allow_url_fopen resides)

# cp /usr/local/lib/php.ini /home//public_html/
Edit the new php.ini file and enable allow_url_fopen in it

allow_url_fopen = On
Save the file. That’s it.

please replace “” with the actual username of the domain wherever stated above.