10/16/2012

Install Centos 6 and httpd+php5.3 +mysql5.5 on Windows Home 7

In order to install centos 6 with your windows, please prepare the following software

1. Download VM VirtualBox
http://www.oracle.com/technetwork/server-storage/virtualbox/downloads/index.html

2.  Download Centos 6
http://ftp.jaist.ac.jp/pub/Linux/CentOS/6/isos/x86_64/


3.  Download VirtualBox 4.2 for Linux
http://download.virtualbox.org/virtualbox/4.2.0_RC4/


Install Process
1. Install VM VirtualBox

2. Install centos

3. update yum
yum update
yum install gcc kernel-devel kernel-headers


4. install virtualLinuxAddtions
If you meet error with[Building the OpenGL support module  [FAILED]] , please use the following command
export MAKE='/usr/bin/gmake -i'

./VBoxLinuxAdditions.run


if you still have errors, please try

/etc/init.d/vboxadd setup


5. install httpd
yum install httpd
#auto start 
chkconfig httpd on 

6. install php
yum install php

7. install mysql
## Remi Dependency on CentOS 6 and Red Hat (RHEL) 6 ##
##  http://mirrors.ustc.edu.cn/fedora/epel/6/
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-XXX.noarch.rpm

## CentOS 6 and Red Hat (RHEL) 6 ##
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

yum --enablerepo=remi,remi-test install mysql mysql-server
#auto start when PC start
chkconfig mysqld on





10/13/2012

install PHP5.3 on centos 5 or centos 6

Before you install PHP.3, you should update extra reposi. Please use the following url


$ wget http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
$ wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm

$ sudo yum install php php-cli php-gd php-mysql php-mbstring

10/12/2012

get the value of more one PHP constants dynamically

using php's constant function

When you define many constants, it is difficult to call them when you use foreach or for clause. Now we may use constant function to realize them.

For example, we define

define('A_1','A');
define('A_2','B');
........
define('A_1000','KKKKKK');


when we use

$a = 88;

echo constant('A_'.$a );

or

for($i=50;$i<70 i="i" p="p">   echo constant('A_'.$i);
}