前几天把linux删掉重装了,又重新搭建了mysql apache php环境,我把安装过程整理成了文档。

1.1 安装准备



  • 机器环境:RedHat Linux 9
  • 下载mysql安装包:MySQL-server-4.1.12-1.i386.rpm,MySQL-client-4.1.12-1.i386.rpm
  • 下载apache安装包:apache_1.3.33.tar.gz
  • 下载php安装包:php-4.3.11.tar.gz
  • tar zxvf php-4.3.11.tar.gz,将文档解压到/usr/local/src
  • tar zxvf apache_1.3.33.tar.gz,将文档解压到/usr/local/src

1.2 安装mysql



  1. 安装mysql服务器端程式:rpm -ivh MySQL-server-4.1.12-1.i386.rpm
  2. 安装mysql客户端程式: rpm -ivh MySQL-client-4.1.12-1.i386.rpm
  3. $mysql,能够看到

    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 1 to server version: 4.1.12-standard

    Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
    mysql>



1.3 安装php



  1. 进入apache的安装文档目录,输入:./configure --prefix=/usr/local/httpd
  2. 进入php的安装文档目录,输入:./configure --prefix=/usr/local/php --with-mysql --with-apache=../apache_1.3.33
  3. make && make install
  4. cp php.ini-dist /usr/local/php/lib/php.ini
  5. 建立符号链接 ln -s /usr/local/php/bin/php /usr/bin/php

1.4 安装apache



  1. 进入apache的安装文档目录,输入:./configure --prefix=/usr/local/httpd --activate-module=src/modules/php4/libphp4.a --enable-module=so --enable-module=rewrite
  2. make && make install
  3. 确保/usr/local/httpd/conf/httpd.conf中有以下内容

    DirectoryIndex index.html index.php
    ...
    AddType application/x-httpd-php .php


  4. 建立符号链接 ln -s /usr/local/httpd/bin/apachectl /usr/bin/apache
  5. 重启apache : apache restart