Author Archives: LinuxTech

Adding a custom php.ini cPanel account

To make your account in cpanel  server have custom php.ini for all subfolder                       You need to use below code steps

1)   Login to server via SSH

2) scp /usr/local/lib/php.ini  /home/cpanelusername/public_html/

3)   vi /home/cpanelusername/public_html/.htaccess

Add below code

suPHP_ConfigPath /home/pankaj12/public_html
<Files php.ini>
order allow,deny
deny from all
</Files>

Once done custom php.ini should be available for all accounts

 

 

 

 

FATAL: Test install failed cpanel

 

If you get below fatal error while updating cpanel

 

[20140325.101511] ***** FATAL: Test install failed:     package cpanel-php54-ingo-3.1.2-3.cp1142.noarch is already installed
[20140325.101511]   The Administrator will be notified to review this output when this script completes
[20140325.101511] ***** FATAL: Error testing if the RPMs will install: Died at /usr/local/cpanel/scripts/updatenow.static-cpanelsync line 14050.
[20140325.101511]   see http://go.cpanel.net/rpmcheckfailed for more information
[20140325.101511]   The Administrator will be notified to review this output when this script completes

SSH to server and run below scripts

#     /scripts/check_cpanel_rpms

#           /usr/local/cpanel/scripts/check_cpanel_rpms –fix

 

This should fix all  RPM issues and cpanel should update fine now

 

 

 

 

“perl: warning: Setting locale failed”

This post shows a simple way of fixing  warning when running perl in linux.

perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = “UTF-8”,
LANG = “en_US.UTF-8”
    are supported and installed on your system.
perl: warning: Falling back to the standard locale (“C”).

Solution:

on your home directory:

1. Edit your user bash_profile

vi .bash_profile

2. Insert the following:

export LANGUAGE=en_US.UTF-8

export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

3. Reload your Bash Profile
# source  .bashrc

This should fix the warning you were getting

 

Lynx file “/etc/lynx.lss” is not available.

Are you getting below error in cpanel for cron  Lynx file “/etc/lynx.lss” is not available” in cpanel server ?  You can fix it using below mentioned setting

 

# vi /var/cpanel/exim.conf.deps   and append it and add below entries                             /etc/lynx.lss

Now Save file and quit and error should dissappear

 

 

 

 

 

Wrong mailbox quota in cPanel

If your cpanel is showing wrong mailbox quota than the actual usage 

You  need to Do the following steps to get it fixed.

Login to your server with root user and check the actual usage of email account

#cd  /home/username/mail/domain.rld /

#du -sch emailaccount

If you found the difference in actual usage and cpanel results then

#cd /home/username/mail/domain.com/emailaccount

# rm -f maildirsize

Now login to your cpanel >> email >> email account option > Reset Quota  and reset  the quota of the account.

 

 

The mod_security plugin could not connect to the database: cPanel

If you have been getting the error “The mod_security plugin could not connect to the  database”

Below are the steps to rectify it

SSH to server

Check the password set for modsec database using below command,

In my case below was the password

root@vps [~]# grep “dbpassword” /etc/cron.hourly/modsecparse.pl

my $dbpassword = ‘qS_lqkU5mXkA’;
my $dbh  = DBI->connect( “DBI:mysql:$dbname:$dbhost”, $dbuser, $dbpassword )

The password set in my case as  qS_lqkU5mXkA

Now login into mysql and use below steps

root@vps [~]# mysql

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1569
Server version: 5.5.36-cll MySQL Community Server (GPL)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> UPDATE user SET Password=PASSWORD(‘qS_lqkU5mXkA’) WHERE USER=’modsec’;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> quit

Login to WHM >> Plugin > Mod_security

You should be able to see working Mod_security

How to find the max inode using folder in server in linux ?

Inodes are the important feature on any server which can sometimes be overused by clients in shared hostingTo find the user or folder using max inodes ,

SSH to server as root

#cd /home     ; Change directory to /home

run below command to see the max using inode account

This will show the max inode folder and then can login to the folder and run below command to see the exact folder which is using max inode

for d in *; do echo -n “$d: “; find $d -type f | wc -l; done

Find Brand of Hard disk in Linux server

Want to fine the find the band name or serial number of the hard disk in Linux sever ?           You just need one package called  hdparm which can be installed using below command

#yum -y install hdparm                                                                                                                  To check hard disk specification run below command

# hdparm -I /dev/sda

Below is the result shown
/dev/sda:

ATA device, with non-removable media
Model Number:       ST1000DM003-9YN162
Serial Number:      S1D55TYB
Firmware Revision:  CC4H
Transport:          Serial, SATA Rev 3.0