Category Archives: cPanel/WHM

locale error in CentOS 6 !

Recently saw the issue in newly build CentOS6 VMs ( For me it was Virtuozzo based VMs ) :

-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8)

Saw this error even after installing cPanel in the VPS.

This warning popped up every time you ran a command in shell, though it did not cause any issues

The fix was to run the following command :

localedef --no-archive -i en_US -f UTF-8 en_US.UTF-8

Should be good now !

 

Issue with CurlSSL on CentOS 4 ! ( Ye, too old :P )

We are talking about CentOS 4 and CurLSSL here. We may have some legacy users facing this issue in enabling CurLSSL.

This was the error encountered :

=======
vtls/openssl.c: In function `Curl_ossl_init’:
make[2]: *** [vtls/libcurl_la-openssl.lo] Error 1
make[2]: Leaving directory `/home/cpeasyapache/src/curl-7/lib’
make[1]: Leaving directory `/home/cpeasyapache/src/curl-7/lib’
dryrun test ‘Find Curl SSL path for PHP 5’ did not return true
!! Dry run failed for ‘Cpanel::Easy::PHP5::CurlSSL’ skipping option !!
— End opt ‘CurlSSL’ —
checking for cURL support… no
checking if we should use cURL for url streams… no
vtls/openssl.c:753: error: `CONF_MFLAGS_DEFAULT_SECTION’ undeclared (first use in this function)
=======

When building curlssl in /home/cpeasyapache/src/curl-7,  this error can be corrected by adding the following :

#ifndef CONF_MFLAGS_DEFAULT_SECTION
#define CONF_MFLAGS_DEFAULT_SECTION 0x0
#endif

to  the file –

/home/cpeasyapache/src/curl-7/lib/vtls/openssl.c

Once this is done, we were able to complete the curlssl compile with ‘make’

You should be able to implement this by moving the old curlssl away and manually installing the modified source tree;

mv /opt/curlssl /opt/curlssl.old

cd /home/cpeasyapache/src/curl-7

make install

EasyApache should use this installed version when it builds next and you will see CurLSSL enabled !

 

cPanel upgrade fails from 11.54 – Services broken !

A recent upgrade from cPanel / WHM 11.54 resulted in the services getting broken and not able to access the services.  Was able to find the following in the logs when attempt to restart cPanel was made :

Can’t locate Unix/PID/Tiny.pm in @INC (you may need to install the Unix::PID::Tiny module) (@INC contains: /usr/local/cpanel /usr/local/cpanel/3rdparty/perl/522/lib64/

The perl module Unix::PID::Tiny is missing which is causing the issues here. The fix would be to rebuild the RPM db.

Follow the steps given below to take backup of current RPM db and rebuild the RPM db:

cd /var/lib
mv rpm{,.old}
mkdir -p rpm
rpm --initdb
cp rpm.old/Packages rpm
rpm --rebuilddb

Kill the hanging RPM or upcp processes if any with the kill -9 $PID command. To find if there are any PIDs, run the following :

ps aux|grep rpm
ps aux|grep upcp

Once this is done, try for an upgrade :

/scripts/check_cpanel_rpms --fix
/scripts/upcp --force

Not able to delete files from file manager – Paper lantern theme

When cPanel is viewed using the Paper lantern theme, there was an error in which we were not able to delete any files over the file manager.

When loading over the Chrome, got the following in console :

utilities_container.js:13 Uncaught TypeError: Cannot set property ‘className’ of nullshow_panel @

As a workaround for this, tried re-installing the cPanel Paper lantern theme.

Removing Paper Lantern can be done by deleting its config folder or putting it in a separate folder.

#  mv /usr/local/cpanel/base/frontend/paper_lantern /root/jo

To re-install the theme simply run a cPanel update :

/scripts/upcp --force

This should fix the issue ! Atleast it worked for me 😀

cPanel service failing to start with a Perl error !

When trying to start the cPanel service via /scripts/restart_cpsrvd, was getting the following error :

cpsrvd: Setting up native SSL support … Can’t locate auto/Net/SSLeay/EC_KEY_new_.al in

The simple fix was to re-install the Net::SSLeay perl module

This can be done via SSH :

/scripts/perlinstaller Net::SSLeay

 

Installing MySQLnd in your cPanel server !

You might want to install the the MySQL native driver for PHP (MySQLnd) over the custom MySQL driver provided with the default EasyApache.

To enable this manually, you will need to edit the file :

/var/cpanel/easy/apache/rawopts/all_php5 and make sure the following entries are in place there :

–enable-mysqlnd
–with-mysqli=mysqlnd

Save the above file, run EasyApache from WHM and recompile as normal.

 

Fix – “Cannot load from mysql.proc, The table is probably corrupted”

For someone who upgraded MySQL from versions 5.0.x to something like 5.5.x, this error might be a familiar one :

“Cannot load from mysql.proc. The table is probably corrupted”

The database activities would not work as expected and hence you will need to fix this error at the earliest.

The recommended solution from MySQL is to run the mysql_upgrade script which examines all tables in all databases for incompatibilities with the current version of MySQL Server.

mysql_upgrade also upgrades the system tables so that you can take advantage of new privileges or capabilities that might have been added.

You can do this by :

# mysql_upgrade -u root

If you are using a cPanel based system, just run

# mysql_upgrade

To force the check, run

mysql_upgrade --force

Does this result in an error ? “”FATAL ERROR: Upgrade failed””

Look for the logs when this happens and try to spot if some invalid db folders are getting listed during the upgrade.

It might be something like :

mysqlcheck: Got error: 1102: Incorrect database name ‘#dbname#.bk’ when selecting the database

The above error indicates you have an invalid db under the mysql dbs folder, usually – /var/lib/mysql.

Navigate to /var/lib/mysql and find if there are any folders with any extension ( keep only valid db folders and move everything else, like backed up files or so from there )

Once this is complete, re-run the mysql_upgrade script !

 

Getting an empty /etc/userdomains file ?

Even though you have several domains, do you see an empty /etc/userdomains file ? This issue can pop up at times when your disk space gets filled up and the cPanel services malfunction. All you need to do is to update the cPanel domain- config files. This can be done by the script :

# /scripts/updateuserdomains

Now, you will be able to see the domains listed !

 

cPanel – Install Nginx + Varnish alongside Apache !

Nginx is a very fast webserver when compared with the default Apache offered by cPanel. Nginx is known for its high performance and low resource consumption. Servers hosting WordPress sites are employing Nginx as it improves the performance.

Nginx will work as a front end reverse proxy of your cPanel server along with apache, which will increase the performance. We have a plugin called ‘Nginx Admin’ which is a cPanel Nginx integration plugin.

Use the following steps to install it on a cPanel server :

1 ) Download the source files :

# cd /usr/local/src
# wget http://nginxcp.com/latest/nginxadmin.tar
# tar xf nginxadmin.tar
# cd publicnginx

2) Generate a Remote Access Key.

Generate a key by logging into WHM, going to Clusters, then Remote Key Access, and then clicking Generate New Key.

3) Run the script

# ./nginxinstaller install

This Nginx installation method integrates with WHM/cPanel and uses the Apache configuration files that WHM/cPanel uses by default.

After installation you can go to WHM, Plugins, and Nginx Admin to handle Nginx. From there you can restart Nginx, edit the configuration files, view logs, and more.

You can also restart Nginx on the command line with the Apache command:

# /etc/init.d/httpd restart

Now lets move ahead with the installation of Varnish.

Varnish is a caching technology known as web accelerator which is used as reverse HTTP proxy, which will enhance the performance of your website.

Varnish stores a copy of the page which is served by the web server the first time a user visits the website. Next time, when the user requests for the same page, varnish will serve the copy instead of serving it from the web server. Thus, your webserver is seldom bought into the lime-light if the used pages are being fetched, which improves the performance.

Before moving ahead, we will bind our webserver to the port 8081, in the file – /usr/local/apache/conf/httpd.conf,

Change the Portion – Listen 0.0.0.0:80 to Listen 0.0.0.0:8081 and restart the webservice.

Now, lets download and install the Varnish !

1) Add the repo : ( check the version of your OS ) : the URL given below is for CentOS / Redhat 5.x versions :

# wget http://repo.varnish-cache.org/redhat/varnish-3.0/el5/noarch/varnish-release/varnish-release-3.0-1.noarch.rpm

# rpm -Uvh varnish-release-3.0-1.noarch.rpm

2) Install the service :

# yum install varnish

3) Edit the configuration file for varnish – /etc/sysconfig/varnish and change the value of VARNISH_LISTEN_PORT to 80

# grep VARNISH_LISTEN_PORT /etc/sysconfig/varnish
VARNISH_LISTEN_PORT=80
4)  Edit Varnish config: /etc/varnish/default.vcl . Correct the backend default Port to reflect – 8081 ( the port to which webserver was bind to )

backend default {
.host = “YOUR IP ADDRESS”;
.port = “8081”;
}

5) Start Varnish service on your server

# chkconfig varnish on

# service varnish start

You are done with installing Nginx and varnish in your cPanel server, which should improve your speed and performance.