apache2、mysql4与php4整合安装

发表于:2007-06-08来源:作者:点击数: 标签:
一、系统环境 本系统为:RedHat Linux ----AdvancedServerrelease2.1AS 此安装也适合与RedHatLinux9.0 二、安装 2.1、源代码(请自行下载,版本相差不远关系不大) my sql -4.x.tar.gz httpd-2.x.tar.gz php-4.x.tar.gz 2.2、安装mysql 请参照mysql时的安装文

一、系统环境
    本系统为:Red Hat Linux----Advanced Server release 2.1AS
    此安装也适合与Red Hat Linux 9.0

二、安装
    2.1、源代码(请自行下载,版本相差不远关系不大)
    mysql-4.x.tar.gz
    httpd-2.x.tar.gz
    php-4.x.tar.gz
    2.2、安装mysql
    请参照mysql时的安装文档:INSTALL-BINARY来安装,里面的详尽的说明。
     shell> groupadd mysql
     shell> useradd -g mysql mysql
     shell> cd /usr/local
     shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
     shell> ln -s full-path-to-mysql-VERSION-OS mysql
     shell> cd mysql
     shell> scripts/mysql_install_db
     shell> chown -R root  .
     shell> chown -R mysql data
     shell> chgrp -R mysql .
     shell> bin/safe_mysqld --user=mysql &
     or
     shell> bin/mysqld_safe --user=mysql &
     if you are running MySQL 4.x
    2.3、安装apache2
    shell> tar zxvf apache2.x.tar.gz    
    shell> cd httpd-2.x
    shell> ./configure
    shell> make
    shell> make install
    apache2.x安装完成
    2.4、安装php4
    shell> tar zxvf php-4.x.tar.gz
    shell> cd php-4.x
    shell> ./configure --with-mysql --with-apxs2=/usr/local/apache2/bin/apxs --enable-versioning --disable-debug --enable-track-vars
    shell> make
    shell> make install
    --with-mysql 表示支持mysql
    其中--with-apxs2=/usr/local/apache2/bin/apxs一定不能少,这个参数把php以动态模块的方式安装到apache下
    2.5、配置httpd.conf
    shell> cd /usr/local/apache/conf
    shell> vi httpd.conf
    加入两行:
    LoadModule php4_module modules/libphp4.so
    AddType application/x-httpd-php .php
    修改Listen x.x.x.x:80
    x.x.x.x是你本机的IP

    三、启动:
    /usr/local/apache/bin/apachectl start

    四、测试
    在/usr/local/apache/htdocs下
    编辑index.php
    <?phpinfo();?>
    在Mozilla中输入http://x.x.x.x/index.php
    可以看见熟悉的php的表以及信息。



本人刚安装完,测试没有问题,大家如有什么问题,可用QQ与我交流。我的QQ是:36117798

 小豆冰棍 回复于:2003-07-24 12:21:17
第二部分,编译apache时候有问题吧。
   你的php通过dso模式和apahe整和,应该打开apche的dso模块啊。
   ./configure --prefix=/usr/local/apache2 --enable-modules=so

 flyingroczsu 回复于:2003-07-25 19:43:07
我编译时是没有问题的.

 南非蜘蛛 回复于:2003-07-28 19:41:05
[quote:d1c4099971="小豆冰棍"]第二部分,编译apache时候有问题吧。
   你的php通过dso模式和apahe整和,应该打开apche的dso模块啊。
   ./configure --prefix=/usr/local/apache2 --enable-modules=so[/quote:d1c4099971]     

????apache2好像默认就打开拉

 linuxs 回复于:2003-08-04 16:56:22
楼主,不行的,出错如下

[root@hjch scripts]# ./mysql_install_db.sh 
./mysql_install_db.sh: line 1: my_print_defaults: command not found
Didn't find @libexecdir@/mysqld
You should do a 'make install' before executing this script

 zhangweibo 回复于:2003-08-04 20:47:06
难道apache2编译的时候自动打开dso???

如果是动态编译php,就应该用不着
LoadModule php4_module modules/libphp4.so 这一句,动态编译应该回自动添加这句

 flyfoot 回复于:2003-08-09 09:30:07
Go to PHP official site, you can get everything you want!!

 xiejp 回复于:2003-08-14 03:42:51
试一下!

 cupidhades 回复于:2005-01-27 10:35:32
怎么改 站点存放的目录 呢?? 
只能放在/usr/local/apache/htdocs下很不爽阿。。。 
先谢谢了!!

 aspbiz 回复于:2005-01-27 13:58:12
靠,

RPM -ivh *.rpm

就Ok了。

原文转自:http://www.ltesting.net