1、操作系统的准备
Redhat 5.0 企业版
2、相关软件的准备
eaccelerator-0.9.5.2.tar.bz2  (php的加速软件)使用后php的执行效率会有较大幅度的提升
mysql-5.0.51.tar.gz
php-5.2.5.tar.gz
httpd-2.2.8.tar.gz
zendoptimizer-3.3.0a-linux-glibc21-i386.tar.gz
gd-2.0.35.tar.bz
3、系统环境的准备
zlib-devel
libjpeg-devel
libpng-devel
libtiff-devel
freetype-devel
openssl-devel
libxml2-devel
gettext-devel
(rpm安装)
4、系统目录的准备
/user/src/下面 建立以下目录 gd  apache php mysql  eaccelerator zend
安装步骤:
一、安装gd
1、tar zxvf gd-2.0.35.tar.gz -C /usr/src
2、cd gd-2.0.35
3、./configure --prefix=/web/gd
4、make;make install
二、安装apache
1、tar zxvf httpd-2.2.8.tar.gz -C /usr/src
2、cd httpd-2.2.8
3、./configure --prefix=/web/apache --with-ssl --enable-ssl --enable-so --enable-rewrite \
>--disable-cgid --disable-cgi
4、make;make install
5、cd /web/apache
6、cp bin/apachectl /etc/rc.d/init.d/httpd
7、在vi/etc/rc.d/init.d/httpd 最后一行添加以下语句:
#chkconfig:2345  10 90
#description:Activates/Deactivates Apache Web Server
8、chkconfig --add httpd
9、chkconfig httpd on
10、service httpd start
三、安装mysql
1、tar zxvf mysql-5.0.51.tar.gz  -C /usr/src
2、cd mysql-5.0.51
3、./configure --prefix=/web/mysql \
>--with-comment=Source
>--with-server-suffix=enterprise-gpl
>--with-mysqld-user=mysql
>--without-debug
>--with-socket-path=/myweb/mysql/var/mysql.sock
>--with-big-tables --with-charset=utf8
>--with-collation=utf8_general_ci
>--with-extra-charsets=all
>--with-pthread --enable-static --enable-thread-safe-client 
>--with-client-ldflags=-all-static
>--with-mysqld-ldflags=-all-static --enable-assembler
>--without-innodb --without-ndb-debug
>--without-isam --enable-loacl-infile
>--with-readline
>--with-raid
4.useradd -g mysql mysql
5.make ;make install
6.cd /web/mysql
7.chown -R mysql .
8.chgrp -R mysql .
9.bin/mysql_install_db --user=mysql
10.chown -R root .
11.chown -R mysql var
12.cp share/mysql/my-medium.cnf /etc/my.cnf
13.cp shaer/mysql/mysql.server /etc/rc.d/init.d/mysqld
14.chmod 755 /etc/rc.d/init.d/mysqld
15.chkconfig --add mysqld
16.chkconfig --level 3 mysqld on
17./etc/rc.d/init.d/mysqld start 或 service mysqld start
18.bin/mysqladmin -u root password 123456
19.create database phpbb;命令创建数据库
四、安装php5
1.tar zxvf php-5.2.5.tar.gz
2.cd /usr/src/php-5.2.5
3../configure --prefix=/web/php \  (安装路径)
> --with-apxs2=/web/apache/bin/apxs \ (加载apache)
> --with-zlib-dir \ ()
> --with-bz2 \
> --with-libxml-dir \
> --with-gd=/web/gd --enable-gd-native-ttf --enable-gd-jis-conv \ (gd库)
> --with-freetype-dir \
> --with-jpeg-dir \
> --with-pbg-dir \
> --with-ttf --enable-mbstring \
> --with-mysql=/web/mysql \  (数据库的位置)
> --with-config-file-path=/etc \  (指定php文件到etc下面)
> --with-iconv --disable-ipv6 --enable-static --enable-zend-multibyte --enable-inline-\
> optimization --enable-zend-multibyte --enable-sockets --enable-soap \
> --with-openssl  \ (对apache和php加密)
> --with-gettext --enable-ftp
4.make;make install
5.cd /usr/src/php-5.2.9/
cp php.ini-recommended /etc/php.ini
五、整合apache与php
vi /web/apache/conf/httpd.conf
ServerRoot "/web/apache" apache安装目录
Listen 80 默认端口号
LoadModule php5_module        modules/libphp5.so  动态加载模块,没有需添加
ServerAdmin you@example.com 用户的邮箱
DocumentRoot "/web/www"
<Directory "/web/www">
 #  Options Indexes FollowSymLinks  是否显示网站的根目录
<IfModule dir_module>
    DirectoryIndex  index.php(添加)  index.html  设置web的默认首页
</IfModule>
AllowOverride None 改成 AllowOverride all  重写功能

[root@Redhat web]# service httpd start
httpd: Syntax error on line 53 of /web/apache/conf/httpd.conf: Cannot load /web/apache/modules/libphp5.so into server: /web/apache/modules/libphp5.so: cannot restore segment prot after reloc: Permission denied
排除:把防火墙禁用(setup)
再重启就ok了!

[root@Redhat web]# service httpd start
Syntax error on line 102 of /web/apache/conf/httpd.conf:
DocumentRoot must be a directory
httpd (pid 31789) already running
需:mkdir /web/www
测试文件:
vi /web/www/text.php
<?php
phpinfo();
?>
测试: http://192.168.1.99/text.php
若在测试的时候发现时下载测试页,找到 AddType application/x-gzip .gz .tgz 在其下添加如下内容:AddType application/x-httpd-php   .php  (支持PHP功能!!!)
六、安装zend
tar zxvf ZendOptimizer-3.3.0a-linux-glibc21-i386.tar.gz -C /usr/src/
cd /usr/src/ZendOptimizer-3.3.0a-linux-glibc21-i386/
./install.sh  安装图示一路安装即可!需注意的是zend的安装目录需更改为/web/zend 
指出apache的命令行 /web/apahce/bin/apachectl
七、安装eaccelerator
tar  jxvf eaccelerator-0.9.5.2.tar.bz2  -C /usr/src/
cd /usr/src/eaccelerator-0.9.5.2/
export PHP_PREFIX="/web/php" //指定一下php的安装目录
$PHP_PREFIX/bin/phpize
./configure  --enable-eaccelerator=shared  --with-php-config=$PHP_PREFIX/bin/php-config
make ;make install
编译安装后我们会看到屏幕提示的eaccelerator.so所在的目录,php5.2x系列是在/web/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so(加速的模块) 记住这个路径,待会儿要用到!
修改php.ini 安装完zend之后php.ini文件放在/web/zend/etc中
vi /web/zend/etc/php.ini 修改下列几项内容
第一种方法:安装为PHP扩展:
注:在文件最后,[zend]之后
[eaccelerator]
extension="/web/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"
eaccelerator.shm_size="32"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
保存之后,mkdir /tmp/eaccelerator
chmod 777 /tmp/eaccelerator
service httpd restart

#添加mysql的主机和端口
vi /web/zend/php.ini              修改其中两句
mysql.default_host = localhost        
mysql.default_port = 3306
 

#安装论坛程序
#解压缩
unzip phpbb3_rc5_zh_phpbbchina.zip
mv phpbb3rc5/ /web/apache/htdocs/phpbb
cd /apache/htdocs/
#指定论坛根目录的权限
chmod -R 777 phpbb