apache+php32位平台安装

一、	系统配置
1、	禁用IPV6
修改/etc/modprobe.conf文件,加入以下两行:
alias net-pf-10 off
alias ipv6 off
2、	启用以下服务 其它服务关闭
acpid  提供高级电源管理 
cpuspeed   可以提高系统运行效率 
apmd  高级电源管理 
crond  执行例行性程序 也就是windows中所谓的计划任务 
iptables    防火墙 
kudzu      自动检测硬件的变更 
network   网络 
readahead_early    加快系统启动 
sshd       SSH终端服务 
syslog     把各类事件写入系统日志
3、yum配置
vim /etc/yum.repos.d/CentOS-Base.repo,删除保留至#released updates,
注释掉mirrorlist这一行,并且将baseurl这一行前面的注释去掉,更改这一行后面的路径。
如下所示:
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=file:///cdrom/Server
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
 
#released updates
挂载光驱:
mount /dev/cdrom /mnt
yum clean all
yum list
安装组件:
yum -y groupinstall 'Administration Tools' 'Development Tools' 'Editors' 'Server Configuration Tools' 'System Tools'

yum -y install zlib-devel openssl-devel


二、系统软件安装
将安装包文件上传至/tmp目录:
cd /tmp
解压work.tar.gz至当前目录
tar -zxvf work.tar.gz

1、install apache
tar -zxvf httpd-2.2.8.tar.gz

编辑./build/ap_release.h文件,44行
修改“#define AP_SERVER_BASEPRODUCT\"Apache\"”
为“#define AP_SERVER_BASEPRODUCT\"Microsoft-ISS/5.0\"”

.编辑./os/unix/os.h文件,35行
修改“#define PLATFORM\"Unix"”
为“#define PLATFORM"Win32\"”

cd httpd-2.2.8
./configure --prefix=/usr/local/apache2 --enable-so --enable-module=so --enable-deflate --enable-mods-shared=all --enable-rewrite --enable-static-support --enable-static-htpasswd --enable-static-htdigest --enable-static-rotatelogs --enable-static-logresolve --enable-static-htdbm --enable-static-ab --enable-static-checkgid --disable-userdir && make && make install && echo $?

返回结果如是0则为成功

去除Apache版本号的方法是修改配置文件/etc/httpd.conf 找到关键字ServerSignature 将其设定为:
ServerSignature off
ServerTokens Prod

安装完成后将启动服务加裁至自启动
/usr/local/apache2/bin/apachectl start
查看进程:
ps -ef |grep http
加裁服务至自启动
vi /etc/rc.local
在最下面加上
/usr/local/apache2/bin/apachectl start

2、install mysql
tar -zxvf mysql-5.0.37-linux-i686-glibc23.tar.gz
cp -r mysql-5.0.37-linux-i686-glibc23 /usr/local/mysql
添加mysql用户和用户组
useradd mysql
cd /usr/local/mysql
改变data文件夹所有者
chown -R mysql.mysql data
用ll命令查看所有者情况
如果网站数据oho5617复制到了mysql目录下,则需要更改权限:
chown -R mysql.mysql oho5617
chmod -R 750 oho5617
创建数据库:
scripts/mysql_install_db --user=mysql
为数据库创建密码:
bin/mysqladmin -u root password 'oho2009'
如果出现可读不可写的加密情况时用:
bin/mysqladmin -P flash -talbes
用mysql用户启动进程
bin/mysqld_safe --user=mysql &
复制配置文件至/etc目录
cp support-files/my-huge.cnf /etc/my.cnf
cp support-files/mysql.server /etc/rc.d/init.d/mysqld
添加mysqld进程
chkconfig --add mysqld
查看进程
chkconfig --list
如果需要将服务在进程在对应的启动模式中自动启动或者不启动则:
chkconfig --level 3 mysqld on/off(增加进程启动或者不启动)
kill -9 进程号,可以杀死进程
启动mysql服务
service mysqld start

3、install curl
tar -zxvf curl-7.17.1.tar.gz
cd curl-7.17.1
./configure --prefix=/usr/local/curl && make && make install

4、install libxml2
tar -jvxf libxml2-2.6.24.tar.bz2
cd libxml2-2.6.24
./configure --prefix=/usr/local/libxml2 && make && make install

5、install jpeg6
mkdir -p /usr/local/jpeg6/bin && mkdir -p /usr/local/jpeg6/lib && mkdir -p /usr/local/jpeg6/include && mkdir -p /usr/local/jpeg6/man/man1
tar -zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b
./configure --prefix=/usr/local/jpeg6/ --enable-shared --enable-static && make && make install

6、install freetype
tar -jvxf freetype-2.3.2.tar.bz2
cd freetype-2.3.2
./configure --prefix=/usr/local/freetype && make && make install

7、install zlib
tar -zxvf zlib-1.2.3.tar.gz
cd zlib-1.2.3
./configure --prefix=/usr/local/zlib && make && make install

8、install libpng
cd $DIR
tar -zxvf libpng-1.2.16.tar.gz
cd libpng-1.2.16
cp scripts/makefile.std makefile && make && make install

9、install gd
tar -zxvf gd-2.0.33.tar.gz
cd gd-2.0.33
./configure --prefix=/usr/local/gd2 --with-png=/usr/local/lib --with-zlib=/usr/local/zlib --with-freetype=/usr/local/freetype --with-jpeg=/usr/local/jpeg6 --with-libxml=/usr/local/libxml2 && make && make install

10、install tidy
tar -jxvf tidy-cvs_20070326.tar.bz2
cd tidy-cvs_20070326
./configure --prefix=/usr/local/libtidy && make && make install

11、install php
tar -zxvf php-5.2.8.tar.gz
cd php-5.2.8
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --enable-inline-optimization --with-config-file-path=/usr/local/php/lib/ --with-libxml-dir=/usr/local/libxml2 --with-gd=/usr/local/gd2 --with-freetype-dir=/usr/local/freetype/ --with-zlib-dir=/usr/local/zlib/ --with-png-dir --enable-mbstring --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --disable-ipv6 --enable-static --enable-sockets --enable-soap --enable-gd-native-ttf --with-ttf --enable-static --enable-mbstring --with-tidy=/usr/local/libtidy --with-png-dir --enable-zip  --with-curl=/usr/local/curl --with-jpeg-dir=/usr/local/jpeg6/   && make && make install

安装php结束后:
重新启动apache和mysql服务
/usr/local/apache2/bin/apachectl stop
/usr/local/apache2/bin/apachectl start

12、下面开始整合php与apache:
vi /usr/local/apache2/conf/httpd.conf
在AddType application/x-gzip .gz .tgz下边添加
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml

注意.php前有一个空格
搜索“AddType text/html .shtml”,搜索结果:
# AddType text/html .shtml
# AddOutputFilter INCLUDES .shtml
把这两行前面的#去掉。
然后搜索“Options Indexes FollowSymLinks”
在搜索到的那一行后面添加“ Includes”
即将该行改变为 Options Indexes FollowSymLinks Includes
把DirectoryIndex index.html改成
DirectoryIndex index.html index.php

修改文件大小限制:
vi /usr/local/php/lib/php.ini
upload_max_filesize = 2M
post_max_size = 8M
将这两个根据要求改成所需的大小,一般建议为1024M

写个测试页到web服务器根目录:/usr/local/apache2/htdocs,若要改变目录可以在主目录下自己增加。
<?php 
phpinfo(); 
?> 
打开浏览器:http://IP地址/测试页文件名
如果主站文件复制后,需要改变文件权限
chmod -R 777 文件夹名

在虚拟机命令行下没有办法使用图开化的浏览器,可以进行如下操作:
安装links
yum install links
links 127.0.0.1/文件名
若看到php信息则成功。

13、脚本
Include conf/vh.conf
虚拟机


AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
ServerSignature off  
ServerTokens Prod


转载于:https://www.cnblogs.com/yuchunju/archive/2012/06/01/2531054.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值