Updating Cpanel Apache Configurations

When changes are made to the httpd.conf on a cPanel server, people don’t update the distiller file normally. So when apache is recompiled, the changes are lost. To avoid this, please be sure that you save the changes to the distiller file by running the following;

/usr/local/cpanel/bin/apache_conf_distiller –update –main

This will confirm that the changes were saved and will save the changes to the main distiller config, saving them for the future apache recompilations.

Installing ImageMagick on a cPanel Server

You can easily install Imagemagick on a cPanel by using cPanel script.

/scripts/installimagemagick will do it for you.

HOLD ON, this is not it yet!!!! We need to get it into PHP rite?

The new WHM has utility to complete the task.

Log into WHM >> Software >> Module Installers >> PHP Pecl and install imagick to get the whole thing binding into PHP.

That should be it, if by any chance you got a problem with a 64 bit OS and WHM can not find imagick then install it manually, by following the steps below

Check if ImageMagick-devel is installed, if not install it using yum.

Then you need to download the Imagick PHP extensions, located here: http://pecl.php.net/package/imagick

cd /usr/src/
wget http://pecl.php.net/get/imagick-x.x.x.tar.gz
tar -zxvf imagick-x.x.x.tar.gz
cd imagick-x.x.x
phpize
./configure
make
make install

Now go back into WHM and try to activate imagick again. That is it 🙂 You are all done.

cPanel Fantastico Installation

SSH to your server and run the following commands from shell:

cd /usr/local/cpanel/whostmgr/docroot/cgi
wget -N http://files.betaservant.com/files/free/fantastico_whm_admin.tgz
tar -xzvf fantastico_whm_admin.tgz
rm -rf fantastico_whm_admin.tgz

Now goto WHM -> Plugins -> Fantastico De Luxe WHM Admin

Upon loading, Fantastico De Luxe WHM Admin will auto-update your existing installation (if existing). All admin files (masterfiles, tarballs, settings etc) will be moved to or created at /var/netenberg.

After the installation is complete, click on “Settings” and go through the settings. While some settings are not important, some other (marked below with an *) are essential for a proper functioning of Fantastico installations.
Language: Select the language for the admin backend AND default language for users without a language selected.
Email notifications: Enter an email address in order to receive notifications when users perform installations using Fantastico.
Master files settings (*): If you are not an advanced user who modifies the master files, leave this to “Remove”. Change this only if you know what you are doing Cheesy
PHPsuexec (*): VERY ESSENTIAL!!! Changing this value will not install or de-install phpsuexec for you. It will only tell Fantastico that you have phpsuexec installed or not installed on your server. Change to “installed” if you perform installations which produce an “Internal Server Error”. Notice: Changes will not apply to existing installations! You have to re-install in order to have working installations.
Path to netPBM: Enter the full path to the netPBM binaries in order to enable Gallery installations. As long as this field has no value, your users will not be able to install Gallery.
Select Fantastico licensing and files server: If the Fantastico pages take long to load switch to the server that works best for you. Fantastico will auto-switch if connections time out.
Update preference: Select latest version (sometimes experimental) or stable version (best working).

EasyApache Internal Server Error

If Easy Apache gives Internal Server Error like this,

“Internal Server Error

Premature end of script headers: /usr/local/cpanel/whostmgr/docroot/cgi/easyapache.pl: Please check / usr / local / cpanel / logs / error_log for the exact error.”

By following the breadcrumbs(i.e. the error message) and checking the error_log, I find that the problem is:

Acme::Spork version v0.0.8 required–this is only version v0.0.7 at /var/cpanel
/perl/easy/Cpanel/Easy/Utils/BackGround.pm line 14.
BEGIN failed–compilation aborted at /var/cpanel/perl/easy/Cpanel/Easy/Utils/Bac
kGround.pm line 14.
Compilation failed in require at (eval 28) line 3.
…propagated at /usr/lib/perl5/5.8.8/base.pm line 85.
at (eval 26) line 3
at /var/cpanel/perl/easy/Cpanel/Easy.pm line 15
BEGIN failed–compilation aborted at /var/cpanel/perl/easy/Cpanel/Easy.pm line 1
5.
Compilation failed in require at (eval 16) line 3.
…propagated at /usr/lib/perl5/5.8.8/base.pm line 85.
BEGIN failed–compilation aborted at /var/cpanel/perl/easy/Cpanel/Easy/Apache.pm
line 8.
Compilation failed in require at /usr/local/cpanel/whostmgr/docroot/cgi/easyapac
he.pl line 67.”

Download and install latest Acme::Spork module in the server (now v0.0.8), it will fix the error.

Upgrade ClamAV in cPanel Server

You can upgrade the clamav installations in the server to the latest version by the following steps.

For 32 bit:
cd /usr/local/cpanel/modules-install/clamavconnector-Linux-i686

For 64 bit:
cd /usr/local/cpanel/modules-install/clamavconnector-Linux-x86_64

Then, download the source of the latest version of ClamAV. You can find the download the latest source at http://www.clamav.net/download/sources/

Now, open the file ‘install’. This file is located in the current directory.
vim install

Find the line ‘AVV=0.95′ and change it to ‘AVV=latest version′

Then edit the file ‘progversion’ and put the latest version of ClamAV there. You can do this with a simple command.

echo “latest_version” > progversion

Finally, run the install script with the command ‘./install’.

And thats it. Your ClamAV should now get upgraded to the latest version.

Fix ssh from WHM

If you are unable to login to cpanel server using ssh, the following script resets the SSH service configuration to the default one.

Substitute the server IP where required and take this in the web browser.

http://your_server_ip:2086/scripts2/doautofixer?autofix=safesshrestart

You will be able to login using SSH now 🙂

Log files in a cPanel server

Log file is a file which stores all the information of all files that are accessed and they also have errors which help a system administrator to troubleshoot issues and fixing them. Few log file locations can be found below:

Apache web server
/usr/local/apache/logs/access_log
/usr/local/apache/logs/error_log
/usr/local/apache/domlogs/domain.com

MySQL database server
/var/lib/mysql/server.hostname.com.err

Exim mail server
/var/log/exim_mainlog
/var/log/exim_paniclog
/var/log/exim_rejectlog

Courier-IMAP
/var/log/maillog

cPanel control panel
/usr/local/cpanel/logs/error_log
/usr/local/cpanel/logs/access_log
/usr/local/cpanel/logs/license_log
/usr/local/cpanel/logs/login_log
path: /usr/local/cpanel/logs/stats_log

FTP server
/var/log/messages
/var/log/xferlog

System logs
/var/log/messages
/var/log/boot.log
/var/log/cron
/var/log/dmesg

Security logs
/var/log/secure
/var/log/messages