ABHIONLINUX
Site useful for linux administration and web hosting

2011/05/25

How to install memcache in the server

You can use the steps below to install memcache



cd /usr/local/src/
wget http://www.monkey.org/~provos/libevent-1.4.13-stable.tar.gz
tar -xvf libevent-1.4.13-stable.tar.gz
cd libevent-1.4.13-stable
./configure 
make
make install


cd ..
wget http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz


tar -xvf memcached-1.4.5.tar.gz
cd memcached-1.4.5
./configure && make
make install


 vi /etc/ld.so.conf.d/libevent-i386.conf  
create this file and add one line ->  # /usr/local/lib/


/sbin/ldconfig


start your memcached server up


/usr/local/bin/memcached -u nobody &


you should add this last command to /etc/rc.local so the memcached server starts if there is a reboot

2011/05/17

How to clear cache memory(RAM) in linux


Clear cache memory.

You can use the command given below to clear the pagecache
echo 1 > /proc/sys/vm/drop_caches

To  free dentries and inodes, you can use the command
echo 2 > /proc/sys/vm/drop_caches

To free pagecache, dentries and inodes:
echo 3 > /proc/sys/vm/drop_caches

2011/05/14

.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable


Is some cases, while browsing your domain you will be getting forbidden page. This is the problem with the directory / files permissions.

From /var/www/vhosts/domain.com/statistics/logs/error_log :  You can get the error

[critical] [client 192.168.1.1] (13)Permission
denied: /var/www/vhosts/domain.com/httpdocs/.htaccess pcfg_openfile:
unable to check htaccess file, ensure it is readable

This is due to incorrect permission for the httpdocs/httpsdocs

cd /var/www/vhosts/domain.com/
chmod 755 httpdocs
chmod 755 httpsdocs


This will work for you.

FFmpeg :: make: *** [ffmpeg_frame.lo] Error 1


When you try to install ffmpeg-php module in the server, you can get the error
FFmpeg :: make: *** [ffmpeg_frame.lo] Error 1

There are two fixes for this issue. Try the first one, if it doesnt fix then go to second.

Fix 1:

In the latest ffmpeg-php, you need to modify the file ffmpeg_frame.c
Usually location will be /usr/src/ffmpeginstaller/ffmpeg-php-0.6.0/ffmpeg_frame.c

Open the above mentioned file and  replace every instance of PIX_FMT_RGBA32 with PIX_FMT_RGB32

Then try to configure it,.

./configure
make
make install


Fix 2:
If the fix1 didnt fix the issue, you can follow this one.

You need to just copy the file ffmpeg_frame.loT to ffmpeg_frame.lo

cd /path/to/ffmpeg-php-0.6.0   ie  cd /usr/src/ffmpeginstaller/ffmpeg-php-0.6.0
cp  ffmpeg_frame.loT ffmpeg_frame.lo
make clean
./configure

This should fix the issue/

How to restore mysql database in linux plesk

You can use the command 'mysql' to restore the database. Exact command is given below.

mysql -u admin -p`cat /etc/psa/.psa/shadow` database_name < database_dump.sql

2011/05/12

How to install commands host, dig and nslookup in linux.


In a new linux server, when you try to run the command given below, it will be getting error.

[root@server /]# host abhionlinux.in
-bash: host: command not found

In such cases, you need to install the bind-utils package in the server.

1. ssh to the server.
2 run the command
[root@server /]# yum install bind-utils

Now host, dig and nslookup will be working fine.

2011/05/08

How to check open ports in linux


nmap -sS -O 127.0.0.1


Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2011-05-08 16:49 CEST
Interesting ports on server.abhi.com (127.0.0.1):
Not shown: 1660 closed ports
PORT     STATE SERVICE
21/tcp   open  ftp
22/tcp   open  ssh
25/tcp   open  smtp
53/tcp   open  domain
80/tcp   open  http
106/tcp  open  pop3pw
110/tcp  open  pop3
111/tcp  open  rpcbind
143/tcp  open  imap
443/tcp  open  https
465/tcp  open  smtps

Device type: general purpose
Running: Linux 2.4.X|2.5.X|2.6.X
OS details: Linux 2.5.25 - 2.6.3 
Uptime 95 days

Nmap run completed -- 1 IP address (1 host up) scanned in 2.341 seconds

2011/05/07

How to reset sshd config using WHM

In somecases your ssh config may have corrupted or ssh port may have blocked in the server due to mistake. In such cases, you can reset the sshd_config from whm.
Login to your whm, then you need to access the URL given below in your browser. Remember to replace the $IPADDRESS with your IP address. This will reset the ssh port to 22.


http://$IPADDRESS:2086/scripts2/doautofixer?autofix=safesshrestart

2011/05/05

Wrong mysql disk usage in cpanel.



You have zero databases in your cpanel account. After login to your cpanel, you can see the mysql database consuming more disk space.  This can be corrected by the following steps.

 Login to server and edit cpanel.config.

[root@server /]# vi /var/cpanel/users/cpanel.config

Replace 'disk_usage_include_sqldbs=0' with  'disk_usage_include_sqldbs=1'

Save this file and run the command given below.

[root@server /]# /scripts/update_db_cache

In the whm-tweak setting, you need to enable the option
'Use INFORMATION_SCHEMA to acquire MySQL disk usage (MySQL 5+ required) '