A great linux stuff website

Monthly Archives: March 2013

The nameservers’ IP assignments are now read from the Zonefiles and actual DNS queries after recent updates. If you are not seeing the needed IPs in /etc/nameserverips please do not attempt to edit that file, as it is now overwritten by cPanel.

Check under WHM: Main >> DNS Functions >> Nameserver IPs for current nameserverips

(Solutions may depend on the cPanel version)

Problem :
The updated A entries and/or NS entries are not retained:
Solution(s) :
Add the needed nameservers to the /etc/hosts file
# vi /etc/hosts

Add (append) a new line, one per IP, onto the existing hosts file such as:
123.456.789.012 ns1.domain.com

OR
123.456.789.012 ns1.domain.com ns2.domain.com

Then run the updatenameserverips script:
# /scripts/updatenameserverips

Check under WHM: Main >> DNS Functions >> Nameserver IPs again to see if it worked, if not continue

Delete the nameserverips.cache file
# rm /var/cpanel/nameserverips.cache

Then modify /var/cpanel/nameserverips.yaml to suite

Then run the updatenameserverips script again


Issue: Website ask for download in cpanel
The issue could be caused due to the apache handler on the server which is not working properly.

The cPanel server is running on DSO instead of the suphp handler.
After running easy Apache all websites on server asking for download at local machine.

Possibly Easy Apache rubild failed run the
# /script/easyapache –force
=========
# /usr/local/cpanel/bin/apache_conf_distiller –update
# /scripts/rebuildhttpdconf
# /etc/init.d/httpd restart
========

Note: take a backup for your php.ini and apache conf file for security reason.

Global Apache handler file for the cPanel server which is need to check and correct it

# /etc/httpd/conf.d/php.conf contain should be following.
==========================
LoadModule php5_module modules/libphp5.so

AddHandler php5-script .php
AddType text/html .php
DirectoryIndex index.php
==========================

The command line utility will solved it. Use belwo command rebuilt/repair above file

# /usr/local/cpanel/bin/rebuild_phpconf 5 none suphp 1


This is long process to install/configure Memcache in cPanel server

Step 1: Configure Apache
Login to cPanel and start EasyApache. At the Exhaustive Option List choose Memcache. Compile Apache & Restart it.

Step 2: Memcache requires LibEvent
LibEvent can be downloaded from Monkey.org. Download the last 1.4.x available version.

wget http://monkey.org/~provos/libevent-1.4.14b-stable.tar.gz
tar xvfz libevent-1.4.14b-stable.tar.gz
cd libevent-1.4.14b-stable
./configure; make; make install

Step 3: Register LibEvent

# vi /etc/ld.so.conf.d/libevent-i386.conf

Add the following text inside:

/usr/local/lib/

and at last, run:

ldconfig

Step 4: Compile and install Memcache (deamon)
Now you can install Memcache with the last version from their site.

# wget http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz
# tar xvfz memcached-1.4.5.tar.gz
# cd memcached-1.4.5
# ./configure; make; make install

Step 5: Install PHP extension for Memcache
Normall, you should be able to do this from cPanel but i get a compiling error. So here is an alternative:

# wget http://pecl.php.net/get/memcache-3.0.3.tgz
# tar xvfz memcache-3.0.3.tgz
# cd memcache-3.0.3
# phpize
# ./configure
# make
# make install

Edit /usr/local/lib/php.ini

# vi /usr/local/lib/php.ini

Copy paste at the end of the file extension and restart Apache:

>>> extension=memcache.so

# /etc/init.d/httpd restart

Step 6: Run Memcache as a deamon on the startup files

# vi /etc/memcached.conf (and add inside:)

#Memory a usar
-m 16
# default port
-p 11211
# user to run daemon nobody/apache/www-data
-u nobody
# only listen locally
-l 127.0.0.1

create the startup files

# touch /etc/init.d/memcached
# chmod +x /etc/init.d/memcached

Addd inside it

# vi /etc/init.d/memcached

the following text then run:

# touch /usr/local/bin/start-memcached
# chmod +x /usr/local/bin/start-memcached

Add inside the following text

Now, let’s test the scripts:

# /etc/init.d/memcached restart

and review if the conf file is parsed ok:

# ps aux | grep memcached

Add memcached as autostart deamon

# /sbin/chkconfig memcached on
# /sbin/chkconfig –list | grep memcached

it should output:

memcached 0:off 1:off 2:on 3:on 4:on 5:on 6:off

Step 7: Test Memcache in PHP
Create the memcache.php file and add this text
You should have in the browser:

String to store in memcached.


WordPress website Set it to one of the pretty permalink settings like below, which is work normal wordpress website.
Website shows internal “server error” apart from the home page.
===================
# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress
===================

While checking the cPanel server apache logs for the specific domain Found below error logs displyed:

===========
[Tue Mar 26 10:11:14 2013] [error] [client xxx.xx.12.xx] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use ‘LimitInternalRecursion’ to increase the limit if necessary. Use ‘LogLevel debug’ to get a backtrace.
===========

Above error logs stated the issue with the redirection for your wordpress website not fetching properly

To Resolve this issue: Replace it with this piece of code in your .htaccess

============

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /index.php/$1 [L,QSA]

===========


During the email queue removal from the cPanel server got the error displayed:

“Message 1KRTsr-0006tc-F6 is locked”

In order to remove this kind of locked email in queue check following steps/command:

check the process for the exim email ID and you will get pid from there.

# ps aux | grep 2MsIERrs-00070jc-D0

# kill-9 pid

# exim -Mrm 1KRTsr-0006tc-F6

Done.. 🙂


When clients will getting the below error.
==================
SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction
==================

Then, You can increase the lock wait timeout value for InnoDB by setting the innodb_lock_wait_timeout, default is 50 sec

You can verify by the below command.
=======
mysql> show variables like ‘innodb_lock_wait_timeout’;
=======

The output will like this:
==============================================
+————————–+——-+
| Variable_name | Value |
+————————–+——-+
| innodb_lock_wait_timeout | 50 |
+————————–+——-+
1 row in set (0.01 sec)
================================================

You can set it to higher value in /etc/my.cnf permanently with this line
For e.g. Here we can set it to 100

======================
[mysqld]
innodb_lock_wait_timeout=100
=======================

and restart mysql. Give it a Try !!!

NOTE : Please do not make the above changes on the shared server.


MySQL server shipped with CentOS 6 / RHEL 6 is still stuck at 5.1, which will soon be EOL. It will be prudent and sane to start preparing the migration to MySQL 5.5.

Here are the steps for the most sane and safe way to get MySQL 5.5 installed on a stock system (i.e. MySQL has not been installed yet, otherwise refer to the next section):

Install the following repos: EPEL, RPMForge, IUS, and Remi. (The links provide an xxx-release.rpm package which sets up everything, look out for that and install them, one for each repo.)
Install yum-plugin-replace. This is required for step 8.
Enable yum plugins by editing /etc/yum.conf and adding plugins=1.
# yum update mysql-libs –enablerepo=remi.
Yum will fetch version 5.5 of mysql-libs from the remi repo.
# yum replace mysql-libs –replace-with mysql55-libs.
Yum will now replace mysql-libs from the remi repo with mysql55-libs from the ius repo.

You may see the following: “WARNING: Unable to resolve all providers: [‘libmysqlclient.so.18(libmysqlclient_18)(64bit)’, ‘mysql-libs(x86-64)’]”.

Ignore it and choose continue.

# yum install mysql55-server mysql55.
Yum will now fetch version 5.5 of MySQL client and server packages from the ius repo.

Done.
If you already have MySQL 5.1 installed on the system with the distro packages, you will need to following steps 1-5 from above first, then proceed below:

First, identify all mysql related packages already installed:

1 $ rpm -qa | grep -i mysql
2 mysql-5.1.61-1.el6 2.1.x86_64
3 mysql-server-5.1.61-1.el6 2.1.x86_64

Then, drop into yum shell and remove and replace those packages within a single transaction:

1 # yum shell
2 remove mysql mysql-server
3 install mysql55 mysql55-server
4 transaction solve
5 transaction run

That’s it. You should be able to successfully replace MySQL 5.1 packages with the 5.5 ones from the ius repository.