文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>APM的安装配置

APM的安装配置

时间:2007-01-13  来源:ppzlyg

一安装前的准备工作

1.创建软件安装目录:
# useradd software
把安装文件拷贝到/home/software目录
删除RH AS 3.0 Update 1 自己带的相关RPM包
rpm -e --nodeps httpd-2.0.46-26.ent
rpm -e --nodeps php-4.3.2-8.ent

二.安装MySQL

# cd /home/software/mysql-4.0.17
# ./configure --prefix=/usr/local/mysql --with-charset=gbk \
--without-debug \去除debug模式
--enable-assembler \使用一些字符函数的汇编版本
--without-isam \去掉isam表类型支持 现在很少用了 isam表是一种依赖平台的表
--with-pthread \强制使用pthread库(posix线程库)
--enable-thread-safe-client \以线程方式编译客户端
--with-client-ldflags=-all-static \
--with-mysqld-ldflags=-all-static \以纯静态方式编译服务端和客户端
--with-raid \激活raid支持

# make

# make install

# ./scripts/mysql_install_db

# cd /usr/local
# groupadd mysql
# useradd mysql -g mysql -M -s /sbin/nologin
# chmod 750 mysql -R
# chgrp mysql mysql -R
# chown mysql mysql/var -R

# chown -R mysql.mysql /usr/local/mysql/var


# cd /home/software/mysql-4.0.17

# cp ./support-files/my-medium.cnf /etc/my.cnf -fv
# cp support-files/mysql.server /etc/init.d/mysqld \copy启动的mysqld文件
# chmod 700 /etc/init.d/mysqld
# cd /usr/local/mysql/libexec
# cp mysqld mysqld.old
# strip mysqld
# chkconfig --add mysqld
# chkconfig --level 345 mysqld on
# service mysqld start
pstree |grep mysqld \查看mysql有没有正常启动
# ln -s /usr/local/mysql/bin/mysql /sbin/mysql
# ln -s /usr/local/mysql/bin/mysqladmin /sbin/mysqladmin
# ln -s /usr/local/mysql/bin/mysqldump /sbin/mysqldump
为了执行命令方便。
增加root用户的密码:

#mysqladmin -u root password 'yourpassword'
# mysql -uroot -p
# 输入你设置的密码
mysql>use mysql;
mysql>delete from user where password=""; #删除用于本机匿名连接的空密码帐号
mysql>flush privileges;
mysql>quit


设置my.cnf文件:


cd /etc

vi my.cnf

[client]
socket = /var/lib/mysql/mysql.sock

[mysqld]
port=3306
socket = /var/lib/mysql/mysql.sock
set-variable = key_buffer_size=16M
set-variable = max_allowed_packet=1M
set-variable = innodb_buffer_pool_size=256M
set-variable = innodb_additional_mem_pool_size=128M
set-variable = innodb_log_file_size=64M
set-variable = innodb_log_buffer_size=16M
set-variable = max_connect_errors=999999999
innodb_data_file_path=ibdata:100M:autoextend
innodb_flush_log_at_trx_commit=1
default-character-set = gbk

三.安装Apache

cd /home/software/httpd-2.0.47

./configure --prefix=/usr/local/apache2 --enable-so \
--enable-mods-shared=most &&
make &&
make install


四.安装PHP


cd /home/software/php-5.0.0b4

./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-apxs2=/usr/local/apache2/bin/apxs --enable-track-vars --enable-ftp

make
make install
cp /home/software/php-5.0.0b4/php.ini-dist /usr/local/php/lib/php.ini -f

修改php.ini文件:

#Edit /usr/local/php/lib/php.ini
#Initialize session on request startup.
#session.auto_start = 0 change to 1
#register_globals = Off change to On(No Comment)


五.修改Apache的配置文件


1.去掉ServerName前面的”#”符号:

ServerName Apache2

修改:

DocumentRoot "/data/phpBB"

修改:

#
# This should be changed to whatever you set DocumentRoot to.
#
#<Directory "/usr/phpBB">

<Directory "/data/phpBB">

2.去掉Indexes支持:

# This may also be "None", "All", or any combination of "Indexes",

Options FollowSymLinks MultiViews

#
# This controls which options the .htaccess files in directories can
# override. Can also be "All", or any combination of "Options", "FileInfo",
# "AuthConfig", and "Limit"
#
AllowOverride None


3.增加默认主页的php支持:

#
# DirectoryIndex: Name of the file or files to use as a pre-written HTML
# directory index. Separate multiple entries with spaces.
#
<IfModule mod_dir.c>
DirectoryIndex index.php index.html
</IfModule>

4.增加php后缀支持:

#
# AddType allows you to tweak mime.types without actually editing it, or to
# make certain files to be certain types.
#
AddType application/x-tar .tgz
AddType image/x-icon .ico

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


5.增加MaxClients值:

在Apache2.0中新加入了ServerLimit指令,使得无须重编译Apache就可以加大MaxClients。下面是prefork配置段。

<IfModule prefork.c>
StartServers 10
MinSpareServers 10
MaxSpareServers 15
ServerLimit 3000
MaxClients 2048
MaxRequestsPerChild 10000
</IfModule>
6.设置自启动
cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd
chmod 700 /etc/init.d/httpd
vi /etc/init.d/httpd
在第二行后增加
# Comments to support chkconfig on RedHat Linux
# chkconfig: 2345 90 90
# description:http server
注意:没有这几行,在使用chkconfig时会提示你:service httpd does not support chkconfig。
Chkconfig - -add httpd
Chkconfig –level 345 httpd on
这样,在运行级别345上httpd就可以自动启动了。

六、修改php.ini文件

# cd /usr/local/php/lib

需要设置为On

; You should do your best to write your scripts so that they do not require
; register_globals to be on; Using form variables as globals can easily lead
; to possible security problems, if the code is not very well thought of.
register_globals = Off


激活session:

; Initialize session on request startup.
session.auto_start = 1

七 测试
mkdir /data/phpBB
cd /data/phpBB
vi index.php
加入
<?php
phpinfo()
?>
保存退出,打开浏览器,输入http://yourip/就可以看到phpinfo的信息了

八 PhpBB的安装
   删除刚才用作测试的index.php,然后把下载的php的安装文件解压到/data/phpBB中,chmod 666 config.php(默认是只读的,会提示你出错的).然后打开浏览器,输入http://localhost应该就会看到安装的页面了。把数据库中输入你刚建的phpbb,用户名可以用root,密码用你刚才设置的密码。然后设上管理员的用户名和密码及信箱。就可以开始安装了。很快就安装完成了,这时会提示删除两个文件夹,你根据提示删除之。就成功了!这样一个自架的服务器就配置成功了!别忘了告诉你的朋友,测试一下哦!

CopyRight:ChinaUnix 作者:好好先生

相关阅读 更多 +
排行榜 更多 +
山雾搜剧 1.0.0

山雾搜剧 1.0.0

系统软件 下载
漫千绘

漫千绘

浏览阅读 下载
布鲁伊一起玩吧2025年

布鲁伊一起玩吧2025年

休闲益智 下载