1.安裝環境
操做系統:Red Hat Linux Enterprise AS 4.0 update4
數據庫:MySQL 5.0.27
Web服務器:Apache 2.2.4
腳本語言:PHP 5.2.1
2.安裝MySQL 5.0.27
下載軟件包mysql-5.0.27.tar.gz後執行以下命令:
# tar zvxf mysql-5.0.27.tar.gz //解壓縮
# cd mysql-5.0.27 //進入解壓縮後的文件目錄
# ./configure --prefix=/usr/local/mysql //設定安裝目錄
--enable-thread-safe-client //編譯線程安全版的客戶端庫
--without-debug //關閉debug功能
--localstatedir=/data/mysqldata //設定數據庫文件目錄
# make //編譯
# make install //安裝
# /usr/local/mysql/bin/mysql_install_db //初始化受權
# chown –R root:root /usr/local/mysql //文件屬性改成root用戶
# cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf //複製配置文件
----------------------------------啓動MySQL服務----------------------------------
# /usr/local/mysql/bin/mysqld_safe --user=root & //啓動MySQL
----------------------------------修改MySQL密碼----------------------------------
# /usr/local/mysql/bin/mysqladmin -uroot password mysqlsecret //修改密碼
----------------------------------關閉MySQL服務----------------------------------
# /usr/local/mysql/bin/mysqladmin -uroot -pmysqlsecret shutdown //關閉MySQL
3.安裝Apache 2.2.4
下載軟件包httpd-2.2.4.tar.gz,後執行以下命令
# tar zvxf httpd-2.2.4.tar.gz
# cd httpd-2.2.4
# ./configure --prefix=/usr/local/apache
--enable-module=most
--enable-shared=max
# make
# make install
----------------------------------啓動Apache服務----------------------------------
# /usr/local/apache/bin/apachectl start
----------------------------------關閉Apache服務----------------------------------
# /usr/local/apache/bin/apachectl stop
----------------------------------重啓Apache服務----------------------------------
# /usr/local/apache/bin/apachectl restart
4.安裝PHP 5.2.1
下載軟件包php-5.2.1.tar.gz後執行以下命令
# tar zvxf php-5.2.1.tar.gz
# cd php-5.2.1
# ./configure --prefix=/usr/local/php
--with-mysqld=/usr/local/mysql
--with-apxs2=/usr/local/apache/bin/apxs
# make
# make install
# cp php.ini-dist /usr/local/php/lib/php.ini
5.配置Apache服務的httpd.conf文件
*
在LoadModule處添加 LoadModule php5_module module/libphp5.so
*在DirectoryIndex處添加 index.php
*在AddType application處添加
AddType application/x-httpd-php .php .phtmlAddType applicatoin/x-httpd-php-source .phps