Archive for the Cpanel/WHM Category

How to Install Mod_Pagespeed on Centos+cPanel ?

Posted in Apache, Cpanel/WHM with tags on September 2, 2012 by Aparna Murthy

>> What is mod_pagespeed ?

mod_pagespeed is basically an open-source module for Apache which does the task of optimizing the web-pages and its resources. Its an automated process and makes use of the filters for enhancment of web performance by re-writing the resources. Performance enhancement for
Apache HTTP Server can easily be achieved using the module.
Installation ::

1. Login to your server using root login

2. Before you start the installation, make sure “mod_deflate” is enabled via easy apache.

3. Determine the version of your kernel via the command ::

# uname -a

In my case its a 64 bit version

root@server [~]# uname -ar
Linux 2.6.18-028stab099.3 #1 SMP Wed Mar 7 15:20:22 MSK 2012 x86_64 x86_64 x86_64 GNU/Linux
4. Once you deteemind the vesion, Go to the directory ::

root@server [~]# cd /usr/local/src

6. Create a directory mod_pagespeed

root@server [~]# mkdir mod_pagespeed
v# cd mod_pagespeed

7. Now download the source of mod_pagespeed using the link ::

>> Link ::
>> Go to the link ::
>> Right click on the “mod_pagespeed 64-bit .rpm (CentOS) and copy the link location

NOTE :: Location is ::

8 . Download >>

# root@server [~]# wget

9. Install the downloaded RPM ::

# root@server [~]# rpm2cpio mod-pagespeed-beta_current_x86_64.rpm | cpio -idmv

The outpu should be as below ::
root@server [~]rpm2cpio mod-pagespeed-beta_current_x86_64.rpm | cpio -idmv
3135 blocks

10. Copy the to the apache modules ::

root@server [~]# cp /usr/local/src/mod_pagespeed/usr/lib64/httpd/modules/ /usr/local/apache/modules/

And then copy the mod_pagespeed.conf to the apache conf directory ::

root@server [~]# cp /usr/local/src/mod_pagespeed/etc/httpd/conf.d/pagespeed.conf /usr/local/apache/conf/

11. Give permissions ::

root@server [~]# chmod 755 /usr/local/apache/modules/

12. Create cache files for the mod_pagespeed ::

root@server [~]# mkdir /var/mod_pagespeed/{cache,files} -p

13. Change ownership of cache files ::

root@server [~]# chown nobody:nobody /var/mod_pagespeed/*

>> Mod_pagespeed needs mod_deflate to be loaded in Apache. If it is not loaded tyou can include it using the command below ::
/usr/local/apache/bin/apxs -c -i /home/cpeasyapache/src/httpd-2.2.22/modules/filters/mod_deflate.c

NOTE :: the apache version “httpd-2.2.16” could be change according to your server. In my case its httpd-2.2.22.

14. 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,

root@server [~]# vi /usr/local/apache/conf/pagespeed.conf
<IfVersion < 2.4>
LoadModule pagespeed_module /usr/local/apache/modules/

<IfModule !mod_deflate.c>
LoadModule deflate_module /usr/local/apache/modules/

15. After that, we’ll need to include the mod_pagespeed configuration in Apache’s configuration file (/usr/local/apache/conf/httpd.conf):

Include “conf/pagespeed.conf”

In order to keep the changes permanant run the command below ::

root@server [~]#/usr/local/cpanel/bin/apache_conf_distiller –update

This will then ensure that your changes are integrated into the templates which WHM cPanel uses to regenerate the httpd.conf file after an automatic update.

You’re done now restart the apache ::

root@server [~]# 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/*.

Error PHP Fatal error: Out of memory (allocated 24641536) (tried to allocate 24381441 bytes) on cPanel server with php scripts

Posted in Cpanel/WHM, PHP/Mysql on May 2, 2012 by Aparna Murthy

Today came across with the memory exhausted error and while investigation note that after increasing the memory in server php.ini file even though increased php memory limit for the particular user as server is suphp enabled, but did not help… 😦 😦

While browsing the site I find the error as below under error logs ::
[root@server/home/username/public_html]# tail -f error_log
[01-May-2012 20:45:55] PHP Fatal error:  Out of memory (allocated 24641536) (tried to allocate 24381441 bytes) in /home/username/public_html/filename.php on line 117

Soution 1 ::

1. If server is suphp enabled then do as below ::

>> create Or copy server php.ini under public_html as below :

#cp /usr/local/lib/php.ini /home/username/public_html

Then open the php.ini file

# vi  /home/username/public_html/php.ini

Find for the memory_limit parameter and change the value as below :

memory_limit = 32 MB


memory_limit = 64 MB

Save the file.

>> Now open the .htaccess file under your public_html

#vi /home/username/public_html/.htaccess

and enter the code below :

suPHP_ConfigPath /home/username/public_html

Save the file.

2. Now try to access your page again and check if that help to resolve the issue.

In my case solution 1 did not help and then I checked the issue further and came to know that the issue was with the apache memory limit. I did check as below :

Solutions 2::

1. Checked the parameter RLimitMEM  under apache configuration file.

# vi /etc/httpd/conf/httpd.conf

Find for RLimitMEM

you will see something like below :

RLimitMEM 154857600 154857600
RLimitCPU 150 200
RLimitNPROC 25 30

Just increase the value of RLimitMEM , In my case I did as below ::

RLimitMEM 184857600 184857600

NOTE :: if you don’t find the value in httpd.conf, please do check in the file /etc/httpd/conf/includes/pre_main_global.conf

and then restart apache on the server.

# service httpd restart

and now try to access your site. your site will work like a charm without any error.

How to Change FTP service Port on cPanel server

Posted in Cpanel/WHM with tags on April 22, 2012 by Aparna Murthy

Today while working come across on the request to change port of the FTP from 21 to some other port that is 921 and I followed the steps below to do so :

Check if your server is using Proftpd and pure-ftpd, To check refer the steps below :

>> Login to your WHM
>> Service Configuration >> FTP Server Selection
>> Here you can see on which radio button is checked.

If you are using pureftpd then follow the steps below :

1. Login to ssh via root

2. Edit /etc/pure-ftpd.conf and look for the following line:

# vi /etc/pure-ftpd.conf
Bind <addr> <port>

Example :: #Bind,21

Replace it with the below line :


NOTE : is a localhost and you must replace it with your certain server ip. You may add the lines for multiple ips under it as below :

================= are just example, you must enter your own server ips.

In my case the port is 921. Save the file.

3. Restart FTP service and cpanel service.

# /etc/init.d/pure-ftpd restart
# /etc/init.d/cpanel restart
Ensure the port 921 is allowed at your firewall.

If you are using proftpd then follow the steps below :

1. Login to ssh via root

2.Edit /etc/proftpd.conf and change:

Port 21


Port 921

3. Save file and restart proftpd and cpanel service.
# /etc/init.d/proftpd restart
# /etc/init.d/cpanel restart

You’re Done.

Correcting ownership of all cPanel Users

Posted in Cpanel/WHM with tags on April 5, 2012 by Aparna Murthy

If you have messed up with the ownership of all the users on a cPanel server, following script will help you to correct the ownership:


# Login to server as a root
# create a shell script and enter the code below :
# vi
Code to be entered :
for i in `cat /etc/trueuserdomains | awk ‘{print $2}’`
/bin/chown $i.$i /home/$i -R;
/bin/chown $i.mail /home/$i/etc -R;
/bin/chown $i.nobody /home/$i/public_html;

Save the file and change the permission for the file permissions.
# chmod 755
Then run the script.
# ./

It will take some time according to the amount of users and The ownership of the home directory of a user, etc and public_tml will be corrected in a one go.


🙂 🙂 🙂

How to install extension Managers on Cpanel Server

Posted in Cpanel/WHM on August 5, 2011 by Aparna Murthy

Installing extension managers like Zend Optimizer or Ion Cube loader without compiling apache on cPanel server is so easy, you can install them using just one script, and the script is located under the normal /scripts directory on Cpanel servers :


It provides the options to list, check status , install or remove any of the extensions.

Using below command you can get the list of extension managers available for installation :

root@CpanelServer[~]# /scripts/phpextensionmgr list
Available Extensions:

Now you can check status of any extension using the below command :

root@CpanelServer[~]# /scripts/phpextensionmgr status IonCubeLoader
Determining status of IonCubeLoader
IonCubeLoader extension is NOT installed

Now I can see that IonCubeLoader is not installed, To install the extension see below :

root@CpanelServer[~]# /scripts/phpextensionmgr install IonCubeLoader
Installing IonCubeLoader
Determining PHP version
Installing IonCube Loader binaries
Activating IonCube Loader extension in /usr/local/lib/php.ini
IonCube Loader extension activated

Now you can check status of any extension using the below command :

root@CpanelServer[~]# /scripts/phpextensionmgr status IonCubeLoader
Determining status of IonCubeLoader
IonCubeLoader extension is installed

Also you can check php version to check if its get complied with php.

Now you can see the required installation is installed.

How to install the GeoIP plugin to show country information in Awstats cPanel

Posted in Cpanel/WHM on June 26, 2011 by Aparna Murthy

Follow these instructions to install and enable the GeoIP plugin in awstats:

Requirement :

1.Root access to server (ssh access)
2. Install GNU Compiler Collection (gcc)
3.Install the GeoIP by executing the following commands in SSH:
Commands :

# wget
# tar xzvf GeoIP.tar.gz
# cd GeoIP*
# ./configure && make && make install

Install the GeoIP Perl module using CPAN :

command :

# cpan

NOTE:  If this is the first time you’re using CPAN, you will be prompted about automatic setup. If you see “Are you ready for manual configuration? [yes]” — type no. If you see “Would you like me to configure as much as possible automatically? [yes]” — type yes.

Then installed the GEoIP per module by executing the below command :

Command :

# install Geo::IP



# quit

to exit the CPAN shell.

Once installed enable the plugin in the awstats.conf as below :
Command :
# vi /usr/local/cpanel/etc/awstats.conf

Insert this code end of the file :

LoadPlugin=”geoip GEOIP_STANDARD /usr/local/share/GeoIP/GeoIP.dat”

Save File.

To enable it for a specfic user then follow the insturction as below :

Command :

# vi /home/username/tmp/awstats/awstats.domainname.conf

NOTE: username and domainname will be replaced by your username and domainname.

Add the code end of the file :

LoadPlugin=”geoip GEOIP_STANDARD /usr/local/share/GeoIP/GeoIP.dat”

Save file.

Once done. Update the weblogs via executing command :


# /scripts/runweblogs username

Note : username will be replaced by your username.

You’re done now!!!!! You will be able to see the GeoIP in your stats page.

cPanel error “not a reference at /usr/local/cpanel/Cpanel/DIp/ line 198, Carp::croak(‘not a reference’) called at /usr/lib/perl5/site_perl/5.6.2/x86_64-linux/ line 76”

Posted in Cpanel/WHM on April 16, 2011 by Aparna Murthy

Today I encountered an  error when I log into cpanel and click on “expand stats” as below :

Error :

not a reference at /usr/local/cpanel/Cpanel/DIp/ line 198
Carp::croak(‘not a reference’) called at /usr/lib/perl5/site_perl/5.6.2/x86_64-linux/ line 76
Storable::logcroak(‘not a reference’) called at /usr/lib/perl5/site_perl/5.6.2/x86_64-linux/ line 244

Solution :

Run and check the permission for “/”  “/sbin/”  “/sbin/ifconfig” file :

# stat / /sbin/ /sbin/ifconfig | egrep -i “File:|(Access|Mode):.*id.*”
You will see output somwhat like below :
# stat / /sbin/ /sbin/ifconfig | egrep -i “File:|(Access|Mode):.*id.*”
File: `/’
Access: (0711/drwx–x–x)  Uid: (    0/    root)   Gid: (    0/    root)
File: `/sbin/’
Access: (0711/drwx–x–x)  Uid: (    0/    root)   Gid: (    0/    root)
File: `/sbin/ifconfig’
Access: (0700/-rwx——)  Uid: (    0/    root)   Gid: (    0/    root)
try resetting permission for the /sbin/ifconfig to 711 as below :

# chmod -vv 0711 /sbin/ifconfig

and restart cPanel

# service cpanel restart.

Error should be fixed now!!!!!!

ModSecurity: Rule execution error – PCRE limits exceeded (-8)

Posted in Apache, Cpanel/WHM on December 8, 2010 by Aparna Murthy

Today while working on one of client’s issue of getting blank page while browsing the website and apache error logs were showing following logs (tail -f /usr/local/apache/logs/error_log):

Error :

==============================================================================[Wed 08 12:15:37 2010] [error] [client XX.XX.XX.XX] ModSecurity: Rule execution error – PCRE limits exceeded (-8): (null). [hostname “”] [uri “/forum/login.php”] [unique_id “TDMQWW3LaKoAAGiQ0EYAAAAP”]


Solution :

In order to solve this error I followed the steps given below :

1) Login to the server as root.

2)Go to directory /usr/local/apache/conf.

Run :

# [root@server~] # cd /usr/local/apache/conf
3)Then Create a file “pcre_modsecurity_exceeded_limits.conf” and paste following lines in it.

Run :

# [root@server conf]# vi pcre_modsecurity_exceeded_limits.conf

Code need to be paste :


SecPcreMatchLimit 150000

SecPcreMatchLimitRecursion 150000

4) Save and quit the file.(Esc+:wq!)

5) Make sure that the permissions assigned for the file are 600.

Run :

#[root@server ~]# chmod 600 /usr/local/apache/conf/pcre_modsecurity_exceeded_limits.conf

6) Now open the file /usr/local/apachec/conf/modsec2.user.conf .

Run :

# [root@server ~]# vi /usr/local/apachec/conf/modsec2.user.conf

7) Find the line “<IfModule mod_security2.c>“

8 ) Add following line just below the above mentioned line that is “<IfModule mod_security2.c>“

Include “/usr/local/apache/conf/pcre_modsecurity_exceeded_limits.conf”


9)Save and quit the file.(Esc+:wq!)

10) Now just restart your apache and mysql service.

Run :

# [root@server ~]# /etc/init.d/httpd restart

# [root@server ~]# /etc/init.d/mysqld restart
The issue should be fixed now.

yum upgade/update “Transaction Check Error:”

Posted in Cpanel/WHM on December 5, 2010 by Aparna Murthy

Today While updating yum on one of Centos server I got the following error :

Error :

Transaction Check Error:file /usr/share/man/man1/xdelta.1.gz from install of xdelta-1.1.4-1.el5.rf.x86_64 conflicts with file from package xdelta-1.1.3-20.i386

Error Summary


I’ve checked the xdelta package on the server by running the following command :

[root@server~]# rpm -qa | grep xdelta



I found two pacakages were installed, I tried to remove one xdelta package but I got the error as below :


[root@server  ~]# rpm –erase xdelta-1.1.3-20

error: “xdelta-1.1.3-20” specifies multiple packages

I’ve tried following to resolve this by running following commands :

[root@server ~]# rpm -q xdelta




[root@server ~]# rpm -q –qf “%{NAME} %{VERSION} %{RELEASE} %{ARCH} %{VENDOR}\n” xdelta

xdelta 1.1.3 20 x86_64 CentOS

xdelta 1.1.3 20 i386 CentOS

And then removed unwanted rpm by running below command :

[root@server ~]# rpm -e xdelta-1.1.3-20.i386


And then again run
[root@server ~]# yum update


Its resolved. cheers!!!!!! 🙂 🙂


Fatal error: Call to undefined function mb_strtolower() on cPanel server

Posted in Cpanel/WHM on December 5, 2010 by Aparna Murthy

I was facing following error on my site :


Fatal error: Call to undefined function mb_strtolower() in


Cause :

The error was due to mbstring php module  was not installed.


To resolve this issue need to recompile apache with Multibye string(mbstring) module.

Once apache is compiled your error should be gone…Cheers!!! 🙂 🙂 🙂