1.安裝環境
作業系統:Red Hat Linux Enterprise AS 4.0
資料庫:MySQL 5.0.24
Web伺服器:Apache 2.2.3
指令碼語言:PHP 5.1.6
2.安裝MySQL 5.0.24
-------------下載軟體包mysql-5.0.24.tar.gz,地址http://www.mysql.com-------------
# tar zvxf mysql-5.0.24.tar.gz //解壓縮
# cd mysql-5.0.24 //進入解壓縮後的檔案目錄
# ./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.3
-------------下載軟體包httpd-2.2.3.tar.gz,地址http://www.apache.org-------------
# tar zvxf httpd-2.2.3.tar.gz
# cd httpd-2.2.3
# ./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.1.6
-------------------下載軟體包php-5.1.6.tar.gz,地址www.php.net--------------------
# tar zvxf php-5.1.6.tar.gz
# cd php-5.1.6
# ./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 .phtml
AddType applicatoin/x-httpd-php-source .phps