Categories
HowTos Linux

How to install Memcache on CPanel / WHM running CEntOS

PHP

Few days back I was working for a client where I had to transfer one application to a new server. Application had memcache php extension need and the following error appeared in apache error log ;

PHP Fatal error: Class ‘Memcache’ not found in

If you are having difficulties in same situation you should stay away from recompiling your php using /scripts/easyapache – BAD IDEA.

Solution is simple, build memcache and include it in php.ini. Let see, how we do it.

Step 1 – Download memcache

mkdir repo
cd repo
wget http://pecl.php.net/get/memcache-3.0.6.tgz
tar -xvfz memcache-3.0.6.tgz

Step 2 – Compilation & installation

cd memcache-3.0.6
phpize

you should see something like this;

Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519

./configure
make
make install

Step 3 – Load in php.ini

Enable memcache in php.ini.

echo "extension=memcache.so" >> /usr/local/lib/php.ini
service httpd restart

Categories
HowTos Linux Troubleshootings

CPanel / WHM Troubleshootings & Short HowTos

CPanel / WHM

CPanel is a popular WHM solution. In past few days, i faced trouble while working with it. Thought to share with you if you face the same problem.

/scripts/easyapache

Not a HASH reference at /var/cpanel/perl/easy/Cpanel/Easy.pm line 340

Solution
/scripts/checkperlmodules --full

How to Disable ConfigServer Security & Firewall
/etc/csf/uninstall.sh

How to Disable Mandatory SSL (Web Login to WHL)
vim /var/cpanel/cpanel.config

Find,

alwaysredirecttossl=1
requiressl=1

And change the “1” to “0”, and save the file changes.
Now execute the following command to effect the changes;
/usr/local/cpanel/whostmgr/bin/whostmgr2 --updatetweaksettings

How to Install RRDTOOL
Download the required packages and execute rpm to install it.
wget http://dag.wieers.com/rpm/packages/rrdtool/rrdtool-1.2.23-1.el5.rf.x86_64.rpm
wget http://dag.wieers.com/rpm/packages/rrdtool/perl-rrdtool-1.2.23-1.el5.rf.x86_64.rpm
wget http://dag.wieers.com/rpm/packages/rrdtool/rrdtool-devel-1.2.23-1.el5.rf.x86_64.rpm
rpm -ivh rrdtool-1.2.23-1.el5.rf.x86_64.rpm rrdtool-devel-1.2.23-1.el5.rf.x86_64.rpm perl-rrdtool-1.2.23-1.el5.rf.x86_64.rpm

[ipcheck] Problem with DNS setup on

When your server hostname doesn’t resolve to IP address and you don’t want to add ‘A’ record in your dns, you will have to disable this script to stop sending these alerts.

ls -l /scripts/ipcheck

-rwxr-xr-x 1 root root 7428 Jun 28 18:47 /scripts/ipcheck

chmod  000 /scripts/ipcheck

Make it write protected, so its permission won’t change.

chattr +i /scripts/ipcheck

ls -l /scripts/ipcheck

———- 1 root root 7428 Jun 28 18:47 /scripts/ipcheck

Categories
HowTos Linux

mount: wrong fs type, bad option, bad superblock

If you are mounting NFS share on your Cpanel WHM Server and see this error, here is the solution;

yum install nfs-utils
/etc/init.d/portmap start
/etc/init.d/nfslock start

and now try to mount it. e.g;

mount 192.168.0.10:/some-share /mnt

Thats it!

Categories
HowTos Linux

The page isn’t redirecting properly

The page is not redirection properly screenshot
The page is not redirection properly Screenshot

If you are a web developer and recently launched website and you are not able to login in It is because of improper permissions on sessions directory defind in php.ini.

simple do;

chmod 777 -R /tmp/site-sessions

This will allow your web server to read/write sessions from this directory.

Personally one of my friend had problem and he lost his self for couple of hours. Hope it helps others too.

Categories
Android HowTos Linux

Installing Android SDK behind proxy requiring authentication

Today I was installing Android SDK on Linux behind authentication proxy server. I tried different settings but there was no way to put user,password in proxy settings. In the end finally I found a workaround to install Squid Proxy on my LinuxMint 11 (Ubuntu based distro) and set proxy to local and it worked enormous!

wget http://http.us.debian.org/debian/pool/main/d/db/libdb5.1_5.1.25-11_amd64.deb
wget http://http.us.debian.org/debian/pool/main/d/db/libdb5.1-dev_5.1.25-11_amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/main/s/squid-langpack/squid-langpack_20110214-1_all.deb
wget http://archive.ubuntu.com/ubuntu/pool/main/s/squid/squid-common_2.7.STABLE9-4ubuntu2_all.deb
wget http://archive.ubuntu.com/ubuntu/pool/main/s/squid/squid_2.7.STABLE9-4ubuntu2_amd64.deb
dpkg -i libdb5.1_5.1.25-11_amd64.deb  libdb5.1-dev_5.1.25-11_amd64.deb squid-langpack_20110214-1_all.deb squid-common_2.7.STABLE9-4ubuntu2_all.deb squid_2.7.STABLE9-4ubuntu2_amd64.deb

vi /etc/squid/squid.conf

search for ‘cache_peer and  put following around there

cache_peer 192.168.0.100 parent 8080 0 no-query default login=username:password
never_direct allow all

Make a note of following :

Real Proxy Server = 192.168.0.100
8080 = proxy server port
Username = Your authentication proxy user name.
Password = Your Password for proxy.

And restart squid
service squid stop
service squid start

Now define following in your application it will work like a charm;

Proxy Server IP : 127.0.0.1
Port : 3128

Hope that works same for you.