打印

[分享] apache2+php5+mysql4 安装配置 AS4

apache2+php5+mysql4 安装配置 AS4

From http://www.xjtusky.com/article.asp?id=49
 平台:RedHat LINUX AS4
版本:httpd-2.0.54
PHP-5.0.4
MYsql4.0.24

1、安装目录
MYSQL /usr/local/mysql
APACHE /usr/local/apache2

2、MYSQL安装
# groupadd mysql
# useradd mysql -g mysql -M -s /bin/false
# cd /usr
# tar zxvf mysql-4.0.24.tar.gz
# cd /mysql-4.0.24
# ./configure --prefix=/usr/local/mysql \ 指定安装目录
--with-client-ldflags=-all-static \
--with-mysqld-ldflags=-all-static \以纯静态方式编译服务端和客户端
# make \要15分钟左右,如果电脑差的话可能会更长
# make install
# scripts/mysql_install_db \生成mysql用户数据库和表文件
# cp support-files/my-medium.cnf /etc/my.cnf \copy配置文件,有large,medium,small三个环境下的,根据机器性能选择,如果负荷比较大,可修改里面的一些变量的内存使用值
# cp support-files/mysql.server /etc/init.d/mysqld \copy启动的mysqld文件
# chmod 700 /etc/init.d/mysqld

#cd /usr/local
# chmod 750 mysql -R
# chgrp mysql mysql -R \更改文件所属的组
# chown mysql mysql/var -R \如果没有这个目录可以mkdir mysql/var
# cd /usr/local/mysql/libexec
# cp mysqld mysqld.old
# strip mysqld \删除可执行程序中的调试信息
# chkconfig --add mysqld
# chkconfig --level 345 mysqld on
# service mysqld start
# netstat -atln
看看有没有3306的端口打开,如果mysqld不能启动,看看/web/mysql/var下的出错日志,一般都是目录权限没有设置好的问题
# ln -s /usr/local/mysql/bin/mysql /sbin/mysql
# ln -s /usr/local/mysql/bin/mysqladmin /sbin/mysqladmin
# mysqladmin -u root password "youpassword" #设置root帐户的密码
# mysql -u root -p
# 输入你设置的密码
mysql>use mysql;
mysql>delete from user where password=""; #删除用于本机匿名连接的空密码帐号
mysql>flush privileges;
mysql>quit

安装MYSQL完成

3、安装APAHCE2(HTTP)\这步相对简单

#cd /usr
#tar ?zxvf /home/server/httpd-2.0.54.tar.gz
#./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite --enable-module-so --enable-ssl
#make
#make install
编译安装完成后,启动apache
#cd /usr/local/apache2/bin
#./apachectl start
这样就启动了apache服务器

4、安装PHP

# cd /usr
# tar -zxvf /home/server/php-5.0.4.tar.gz
# cd php-5.0.4
#./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql=/usr/local/mysql --with-config-file-path=/usr/local/lib --enable-track-vars --with-xml
# make
# make install
安装完成的,修改apache的配置文件httpd.conf
在相应的位置加入以下语句:

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
AddType application/x-httpd-php .php3

重启apache即可;
测试PHP
编写 info.php文件,内容如下:

<?php
phpinfo();
?>

将其存放在apache的文档路径下,在浏览器中输入:
http://127.0.0.1/info.php
即可看到php 的配置信息,如果报错,请先查看该文件的权限设置,如果不行则查看日志

apache的开机自动启动:
#cd /etc/rc.d/init.d
#ln -s /usr/local/apache/bin/apachectl httpd
chmod 700 httpd
vi httpd
把文件头的部分的chkconfig 和 description改成:
# chkconfig: 2345 10 90
# description: Activates/Deactivates Apache Web Server

最后,运行chkconfig把Apache添加到系统的启动服务组里面:

# /sbin/chkconfig --del httpd
# /sbin/chkconfig --add httpd 

[ 本帖最后由 43005198 于 2007-7-11 22:32 编辑 ]

TOP

谢谢楼主分享

学习中~

TOP

也在搞一个测试的网络CRM,正好可以试试看了。
『 人在江湖飘,谁能不挨刀 』
『 出来混,早晚是要还嘀 』
-= Songham@Gmail.com =-
-= iTePub--Sharing Ur Ebook =-

TOP

一直没有试过linux, 什么时候心血来潮试试看

TOP

我也想要,可是怎么没看到下载

TOP

只是文章没有视频的?

TOP

本功能由奇虎搜索实现

相关主题

标题 作者 最后发表