Monday, February 7, 2011

Installing PHP > 5.2.X on CentOS 5 using yum

1, import testing repository key
rpm --import http://dev.centos.org/centos/RPM-GPG-KEY-CentOS-testing

2 download CentOS testing repoitory
cd /etc/yum.repos.d/
wget http://dev.centos.org/centos/5/CentOS-Testing.repo

3 install or update
update: yum --disablerepo=* --enablerepo=c5-testing update php
or fresh install: yum --disablerepo=* --enablerepo=c5-testing install php

4, restart httpd
/etc/init.d/httpd stop
/etc/init.d/httpd start

Friday, February 4, 2011

How can I rename table names in mysql

mysql> rename table sas to sds;

mysql create table command line

CREATE TABLE suppas (id int(15) NOT NULL auto_increment, su_id int(12) default NULL, c_id int(12) default NULL, PRIMARY KEY (id) ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;

Wednesday, February 2, 2011

linux sort a file

greg@SS:/site# sort cas.txt > cas2.txt

linux get file line number

greg@SS:/site# wc -l cas.txt
3725 cas.txt

grep regular expression space

greg@SS:/site# less APAC.txt | grep '[0-9]\{2,7\}-[0-9]\{1,2\}-[0-9]\{1\}' > abc.txt

greg@test:/test$ less filtered.txt | grep "^[0-9]\{1,10\}[[:space:]]\{1,20\}[0-9]\{2,7\}-[0-9][0-9]-[0-9]$" > filtered.txt1

html redirect

Add this line in your homepage header: 




<meta HTTP-EQUIV="REFRESH" content="0; url=http://www.yourdomain.com/">