Archive

Archive for December, 2011

How to install memcache

December 28th, 2011 No comments

How to install memcache

Definition:

Memcache is a high-performance memory object caching system intended to speed up dynamic web applications by alleviating database load. Memcache is extremely fast. It uses libevent, which provides a mechanism to execute a callback function when a specific event occurs on a file descriptor, to scale to any number of open connections. On a modern Linux system memcached utilizes epoll, is completely non-blocking for network I/O, ensures memory never gets fragmented, and uses its own slab allocator and hash table to achieve 0(1) virtual memory allocation.

How it install memcache:

#curl -O http://monkey.org/~provos/libevent-1.4.9-stable.tar.gz

#tar -xzvf libevent-1.4.9-stable.tar.gz

#cd libevent*

#./configure

#make

#make install

Now let’s download the newest Memcached source

#curl -O http://www.danga.com/memcached/dist/memcached-1.3.0.tar.gz

#tar zxf memcached-1.3.0.tar.gz

#cd memcached-1.3.0

#./configure

#make

#make install

Then add /usr/local/lib to LD_LIBRARY_PATH in your .bash_profile

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
export LD_LIBRARY_PATH

Add the below link in php.ini of the server

extension=memcache.so

Now restart Apache:

Service httpd restart

Once it sucussfully install you can create phpinfo() on your webserver should now confirm that memcache is installed.

 

Categories: Installation, PHP Tags:

How to take Database Backup using phpMyAdmin

December 28th, 2011 No comments

How to take Database Backup using phpMyAdmin.

First you need phpMyAdmin which is a MySQL Database Administration Tool.

1 – Open phpMyAdmin

2 – Click on Export

3 – Under Export – Select the database you want to backup

4 – Select SQL

5 – Select Structure, Add DROP TABLE, Add IF NO EXISTS, Add AUTO_INCREMENT VALUE and Enclose table and field names with backquotes.

6 – Select Data, Complete inserts, Extended inserts and Use hexadecimal for binary fields.

7 – Select Save as file your data base. Here you can use any name you want.

9 – In Compression specify your choice.

10 – Click Go.

How to restore a Database using phpMyAdmin.

1 – Open phpMyAdmin

2 – On the far right hand side, click on the little SQL box and a window should open

3 – In this window click on Import Files

4 – Use the browse button to find the database file.

5 – In Compression Select the option you chose to export the database

6 – Click Go.

 

Categories: MySql, Uncategorized Tags:

Mysql Commands

December 28th, 2011 No comments

Mysql Commands:

How to check mysql connection or login to your Database using shell
=========================
[email protected][#] mysql -u username -p
=========================
it will ask for password then provide the correct password.

 

Create Database on the Mysql Server
=========================
mysql> create database [databasename];
=========================
ex : mysql>create database Dresses;

 

List all databases on the sql server.
===========================
mysql> show databases;
===========================

 

To List all tables in the Database.

==========================
mysql> show tables;
==========================

 

To check the table Constraints or Describe table
==========================
mysql> describe [table name];
==========================

 

To Delete a Database
==========================
mysql> drop database [database name];
==========================

 

To delete a table.
==========================
mysql> drop table [table name];
==========================

 

Command to give privileges to the user

[email protected][#]mysql

grant all privileges on test_wrdp1.* to [email protected] identified by ‘test123’;

database name = test_wrdp1
db user name = test_wrdp1
db pass = test123

Categories: MySql, Uncategorized Tags:

How to download the files forcefully using .htaccess

December 28th, 2011 No comments

How to download the files forcefully using .htaccess without displaying it in browser

 

Create .htacceses file under your accout and insert the below code.

AddType application/octet-stream .avi

AddType application/octet-stream .mpg

save and quit the file.

 

Categories: Uncategorized Tags:

How to install APC for php in linux server

December 20th, 2011 No comments

How to install APC for php in linux server

pecl install php
 

You can use the below steps to install it manually.

wget http://pecl.php.net/get/APC
tar -zxf APC-3.1.9.tgz
cd APC-3.1.9
whereis php-config
./configure –enable-apc –enable-apc-mmap –with-apxs–with-php-config=/usr/bin/php-config
make
make install
restart the apche
/etc/init.d/httpd restart
 
 
If you are getting below error message :
/root/tmp/pear/APC/apc.c:454: error: ‘apc_regex’ has no member named ‘preg’
then you have to intall php-devel on server.
you can check the php-devel packages using the below command.
yum list php-devel
Once it will show the packages then you can install it using the below command.
yum install php-devel

 

Categories: Installation, PHP Tags:

Command to check server inode value

December 15th, 2011 No comments

Command to check  server inode value

Fire the below command in shell.
[email protected][~]# df -i

It will provide the below output.
Filesystem            Inodes               IUsed             IFree              IUse          %      Mounted on
/dev/sda4            182796288     58405          24 1769           55764     4%       /
/dev/sdb1            244154368      5659             751 238          494617   3%      /backup
/dev/sda2             183264              540               182724                             1%      /tmp
/dev/sda1              24480             77                     24403                             1%       /boot

The inode value of server is : 182796288

 

Categories: Uncategorized Tags:

How to enable php.ini for all the folders under one account

December 14th, 2011 No comments

 How to enable php.ini for all the folders under one account

Copy the php.ini file in the public_html folder of the user using below command.cp /usr/local/apache/php.ini .

Then create .htaccess file and insert the below command:

SetEnv PHPRC /home/username/public_html

Note: In place of username you have to use the clients or your username.

 

Categories: PHP, Uncategorized Tags:

404 error code for all third party applications

December 14th, 2011 No comments

404 error code for all third party applications


Copy and paste the code in .htaccess file
 
For main domain only

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
 
Below one for the subdomain
 
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /subdirectory/
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /subdirectory/index.php [L]
</IfModule>
 
Categories: CPanel / WHM, Uncategorized Tags:

IPtables

December 14th, 2011 No comments

IPtables:

 
Exact meaning of an option which are used in iptable command:


A – All source
I – INPUT
s – Source
j – jump on

Procedure:

For Example: If you want to check IP 49.248.23.83 is blocked or not then fire command


iptables -nL | grep 49.248.23.83

You can see the result as below

DROP all — 49.248.23.83 0.0.0.0/0
DROP all — 0.0.0.0/0 49.248.23.83
 
Which means IP is blocked

To unblock that IP address use following command:


iptables -I INPUT -s 49.248.23.83 -j ACCEPT
 
To Block back an IP Address:
 
iptables -A INPUT -d 49.248.23.83 -j DROP

After adding or removing ips from iptables you need to save iptable rule using following command.
service iptables save
 
service iptables restart
 
To allow PORT in iptables you have to follow below commands

Exact meaning of an options which uses in the command
=====================================
p – protocol

dport – destination port
j – jump on
=====================================

iptables -I INPUT -p tcp –dport 2082 -j ACCEPT

iptables -I INPUT -p udp –dport 2082 -j ACCEPT

iptables -I OUTPUT -p tcp –dport 2082 -j ACCEPT

iptables -I OUTPUT -p udp –dport 2082 -j ACCEPT

To drop (block) port in iptables you have to follow below commands:

iptables -I INPUT -p tcp –dport 2082 -j DROP

iptables -I INPUT -p udp –dport 2082 -j DROP

iptables -I OUTPUT -p tcp –dport 2082 -j DROP

iptables -I OUTPUT -p udp –dport 2082 -j DROP

After adding or removing iptables you need to save iptable rule using following command.

  • service iptables save
  • service iptables restart

To enable range of port in iptables

 
iptables -A INPUT -p tcp –destination-port 1568:1570 -j ACCEPT

iptables -A OUTPUT -p tcp –source-port 1568:1570 -j ACCEPT

 
  • service iptables save

  • service iptables restart

Categories: Uncategorized Tags:

Frame Forwarding

December 13th, 2011 No comments

To redirect the page without changing web address. You can use the below code:

Create the index page and insert the below code:

<html>
<body>
<FRAMESET ROWS=”*,0″ FRAMEBORDER=0 BORDER=0 FRAMESPACING=0>
<FRAME SRC=”http://www.domain.com.ie/” NORESIZE>
</FRAMESET>
</body>
</html>

[notice]Change your domain.com to your actual domain name. [/notice]

 

Categories: Uncategorized Tags: