1. 安装mysql
cd /usr/local/src/ 
wget http://syslab.comsenz.com/downlo ... -icc-glibc23.tar.gz 
tar zxvf /usr/local/src/mysql-5.1.40-linux-i686-icc-glibc23.tar.gz 
mv mysql-5.1.40-linux-i686-icc-glibc23 /usr/local/mysql 
useradd -s /sbin/nologin mysql 
cd /usr/local/mysql 
mkdir -p /data/mysql 
chown -R mysql:mysql /data/mysql 
./scripts/mysql_install_db --user=mysql --datadir=/data/mysql 
cp support-files/my-large.cnf /etc/my.cnf 
cp support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld 
vim /etc/init.d/mysqld   #修改datadir
chkconfig --add mysqld 
chkconfig mysqld on 
service mysqld start

步骤:1、建立mysql 用户 ;2、建立mysql存储目录;3、初始化数据库;4、COPY配置文件;5、copy启动文件;6、修改启动文件中的datadir路径;

2. 安装apache
wget http://syslab.comsenz.com/downloads/linux/httpd-2.2.16.tar.gz
tar zvxf httpd-2.2.16.tar.gz  
cd httpd-2.2.16 
./configure --prefix=/usr/local/apache2  --enable-mods-shared=most  --enable-so
make && make install 

【如何指定使用worker/prefork】 http://www.lishiming.net/thread-944-1-1.html
【apache两种工作模式】http://www.lishiming.net/thread-838-1-2.html

3.  安装php
wget http://cn2.php.net/distributions/php-5.3.28.tar.gz 
tar zxf php-5.3.28.tar.gz 
cd php-5.3.28 
./configure   --prefix=/usr/local/php   --with-apxs2=/usr/local/apache2/bin/apxs   --with-config-file-path=/usr/local/php/etc   --with-mysql=/usr/local/mysql   --with-libxml-dir   --with-gd   --with-jpeg-dir   --with-png-dir   --with-freetype-dir   --with-iconv-dir   --with-zlib-dir   --with-bz2   --with-openssl   --with-mcrypt   --enable-soap   --enable-gd-native-ttf   --enable-mbstring   --enable-sockets   --enable-exif   --disable-ipv6 
make && make install 

说明:关于模块的加载,建议启用支持的相应模块
4. 配置apache结合php
vim /usr/local/apache2/conf/httpd.conf
找到:
AddType application/x-gzip .gz .tgz
在该行下面添加:

AddType application/x-httpd-php .php
找到:
<IfModule dir_module>
    DirectoryIndex index.html
</IfModule>
将该行改为:
<IfModule dir_module>
    DirectoryIndex index.html index.htm index.php
</IfModule>
找到:
#ServerName www.example.com:80
修改为:
ServerName localhost:80

5. 测试解析php
vim /usr/local/apache2/htdocs/1.php
写入:

<?php
    echo "php解析正常";
?>


——————————————————————————————————————————————————————

1.Apache要提供中文支持,可以在配置文件(默认为Httpd.conf)中加入以下行:
AddDefaultCharset      GB2312
但就笔者的经验,Apache的内容服务是可以支持中文,但是Apache的配置文件的内容(除了注释内容)是不支持中文的。比如我想在Apache中建立一个“我的网站”的别名指向“C:/我的网站/”这个目录,使用指令“Alias /我的网站/      C:/我的网站/”是不行的,无论是别名,还是目录名中,都是不能出现中文的,否则Apache就因加载不了配置文件而无法启动。
不知道这是Apache固有的特性还是我有什么设置没有配好,还希望高手指点迷津。

2.PHP中,是通过在配置文件(一般为php.ini)中添加“default_charset = GB2312”这样的行实现的。

3.MySQL的语言设置有些复杂。既可以对服务器设置默认字库,也可以对数据库的单独表格进行字符集设置,最细致的莫过于还能对单独的字段(Field)进行设置(据说是从4.1版开始的)。每处同时要设置Charset(字符集)和Collcation(拼写检查)两个选项。
(1)在MySQL中的配置文件(通常是my.ini)中加入
#设置字符集
default-character-set=gbk
#设置拼写检查
default-collation=gbk_chinese_ci
来支持中文。不设置的话使用Latin5字符集。
也可在MySQL Administrator>>Startup Variables>>Advanced>>Localization中进行设置。
(2)对表格的字符集设置,是在MySQL Administrator中的选中表格>>Edit Table>>Table Options>>Character Set来设置的。留空的话使用服务器默认字体。
(3)MySQL Administrator中的选中表格>>Edit Table>>Columns and Indices>>选中列>>Column Details中进行字符集设置。留空的话使用表格默认字体。