整合安装PHP4+Mysql+Apache的步骤

整合安装PHP4+Mysql+Apache的步骤

整合安装PHP4+Mysql+Apache的步骤
一 需要的软件包:
apahce-1.3.26.tar.gz  
mysql-3.22.30.tar.gz
php-4.0.6.tar.gz
phpAdmin-2.2.2.tar.gz
(说明:这些软件包很快可以通过http://e.pku.edu.cn 的ftp文件搜索器搜索到,如果你的
网络情况不是太糟糕的话。)


二  安装步骤
   以root用户的身份进入

1 解压缩软件包
# tar zxvf apache_1.3.26.tar.gz
# tar zxvf mysql-3.22.30.tar.gz
# tar zxvf php-4.0.6.tar.gz
(可以全部放到/root目录下)

2 安装mysql
# cd mysql-3.22.30
# ./configure --prefix=/usr/local/mysql
# make
# make install
# scripts/mysql_install_db
# cd ..

3 安装php4
# cd apache_1.3.26
# ./configure --prefix=/usr/local/apache
# cd ..
# cd php-4.0.6
# ./configure --with-apache=../apache_1.3.26 \
--with-mysql=/usr/local/mysql \
--enable-track-vars
# make
# make install
# cp php.ini-dist /usr/local/lib/php.ini
# cd ..


4安装apache
# cd apache_1.3.26
# ./configure \
# --prefix=/usr/local/apache \
# --activate-module=src/modules/php4/libphp4.a \
# make
# make install
# cd..

5配置apache
编辑 /usr/local/apache/conf/httpd.conf
将# addtype application/x-httpd-php .php 的#删除
并改为
addtype application/x-httpd-php .php .php3
并在AccessFileName .htaccess一行的前面加入
DirectoryIndex index.html index.htm index.asp index.php index.php3

至此安装完成。


三 测试阶段

测试工具:phpMyAdmin
软件包: phpMyAdmin-2.2.2.tar.gz

   1 解压开该管理工具
     # tar -zxvf phpMyadmin-2.2.2.tar.gz
     # cp phpAmdin-2.2.2  /usr/local/apache/htdocs/phpAdmin
     # cp phpAmdin-2.2.2  /usr/local/mysql/phpAdmin
   2 运行数据库
     #cd /usr/local/mysql/bin
     #./safe_mysqld &
   3 运行apache
     #cd /usr/local/apache/bin
     #./apachectl start
   4 通过远程主机web访问服务器机.
     可以浏览php编写的网页,访问目录htdocs/phpAdmin/main.php
     选择 chinese simplified(简体中文) 方式看是否可以管理mysql数据库.
      (这个工具很方便,简单,强烈建议try 一次).

四 注意事项
     如果按照上面的安装步骤,mysql的管理员将是root 密码为空.

   -----------------------------------------------------
   我是一个新手,这样的老问题摆出来,希望不要扔砖头       
我也正想学.

不过在安装mysql时,编译时遇到难题.请指教:

[root@linux mysql]# make
make: *** No targets specified and no makefile found. Stop.
=========================
[root@linux data]# more linux.err
020819 10:28:23 mysqld started
Fatal error: Can't change to run as user 'mysql' ; Please check that the user e
xists!
020819 10:28:23 Aborting

020819 10:28:23 /home/mysql/bin/mysqld: Shutdown Complete

020819 10:28:23 mysqld ended

020819 10:39:03 mysqld started
020819 10:39:03 /home/mysql/bin/mysqld: Can't create/write to file '/ho
me/mysql/data/linux.pid' (Errcode: 13)
020819 10:39:03 /home/mysql/bin/mysqld: Can't find file: './mysql/host.
frm' (errno: 13)
020819 10:39:03 /home/mysql/bin/mysqld: Error on delete of '/home/mysql/data/linux.pid' (Errcode: 13)
020819 10:39:03 mysqld ended

020819 10:42:32 mysqld started
020819 10:42:32 /home/mysql-3.23.52-pc-linux-gnu-i686/bin/mysqld: Can't
create/write to file '/home/mysql-3.23.52-pc-linux-gnu-i686/data/linux.
pid' (Errcode: 13)
020819 10:42:32 /home/mysql-3.23.52-pc-linux-gnu-i686/bin/mysqld: Can't find file: './mysql/host.frm' (errno: 13)
020819 10:42:32 /home/mysql-3.23.52-pc-linux-gnu-i686/bin/mysqld: Error on delete of '/home/mysql-3.23.52-pc
-linux-gnu-i686/data/linux.pid' (Errcode: 13)
020819 10:42:32 mysqld ended      
查看 ./configure 的提示信息有没有生成相应的makefile ,如果有,设置一下环境变量 export ../../mysql,再试试看。此外,出错信息提示 mysql用户不存在,不妨开一个用户mysql,记住,安装mysql要么用root或者mysql ,启动的时候也要用到相应的安装用户,涉及到用户权限,但不这样很可能出错。