ny3259 发表于 2015-8-5 09:06:38

centos 4.5(32位服务器)+php+apache+zend+mysql环境架构

centos 4.5(32位服务器)+php+apache+zend+mysql环境架构Linux的版本是centos 4.532位服务器
默认安装GCC 和sedmail软件(可选)

一、软件准备
Apache-2.2.8
php-5.2.6
mysql-5.0.45.tar.gz
ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz
安装的推荐顺序是mysql->gd->apache->php->zend

二、安装MySQL
wget http://download.softagency.net/MySQL/Downloads/MySQL-5.0/mysql-5.0.45.tar.gz
tarzxvf mysql-5.0.45.tar.gz
cd mysql-5.0.45
./configure--prefix=/usr/local/mysql --without-innodb --without-debug--with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static--with-linuxthreads --enable-thread-safe-client--with-charset=gbk
--without-debug \去除debug模式
--without-innodb\去掉innodb表支持 innodb是一种支持事务处理的表,适合企业级应用
--enable-thread-safe-client\以线程方式编译客户端
--with-client-ldflags=-all-static \
--with-mysqld-ldflags=-all-static \以纯静态方式编译服务端和客户端
make
makeinstall
cp support-files/my-medium.cnf /etc/my.cnf
groupaddmysql
useradd -g mysql -s /sbin/nologin mysql
cd/usr/local/mysql
bin/mysql_install_db --user=mysql
chown -R root.
chown -R mysql var
chgrp -R mysql.
mysql的启动和关闭命令
/usr/local/mysql/share/mysql/mysql.serverstart
/usr/local/mysql/share/mysql/mysql.server stop

三、安装gd库
libpng
http://prdownloads.sourceforge.net/libpng/libpng-1.2.8-config.tar.gz?download
tarzxvf libpng-1.2.8-config.tar.gz
cd libpng-1.2.8
./configure --prefix=/usr/local/libpng2
Make
Makeinstall
Jpeg v6b
http://www.ijg.org/files/jpegsrc.v6b.tar.gz
tar zxvfjpegsrc.v6b.tar.gz
cd jpeg-6b
./configure--prefix=/usr/local/jpeg6
make
mkdir /usr/local/jpeg6
mkdir/usr/local/jpeg6/include
mkdir /usr/local/jpeg6/lib
makeinstall-lib
mkdir /usr/local/jpeg6/bin
mkdir /usr/local/jpeg6/man
mkdir/usr/local/jpeg6/man/man1
make install

FreeType2
http://jaist.dl.sourceforge.net/sourceforge/freetype/freetype-2.1.10.tar.gz
tarzxvf freetype-2.1.10.tar.gz
./configure--prefix=/usr/local/freetype2
make
make install

GD Library gd-2.0.18
http://www.boutell.com/gd/http/gd-2.0.18.tar.gz
tar zxvfgd-2.0.18.tar.gz
./configure --prefix=/usr/local/gd2--with-png=/usr/local/libpng2 --with-jpeg=/usr/local/jpeg6--with-freetype=/usr/local/freetype2
make
make install

四apache的源码编译
wget http://apache.mirror.phpchina.com/httpd/httpd-2.2.8.tar.gz
./configure--prefix=/usr/local/apache2 --enable-so--enable-rewrite=shared--enable-deflate=shared --enable-expires=shared--with-mpm=worker
make
make install
说明
#--enable-so apache2支持模块动态加载
#--enable-rewrite=shared 支持 URL 重写
#--enable-deflate=shared支持网页压缩
#--with-mpm=worker 采用worker的mpm方式运行
#--prefix=/usr/local/apache2安装目录

五源码编译php
zlib-1.2.3
http://www.zlib.net/zlib-1.2.3.tar.gz
tar zxvfzlib-1.2.3.tar.gz
# ./configure --prefix=/usr/local/zlib2
# make
#make install
libxml
http://ftp.gnome.org/pub/GNOME/sources/libxml2/2.6/libxml2-2.6.19.tar.gz
#cd libxml2-2.6.19
# ./configure--prefix=/usr/local/libxml2(PHP5只支持libxml2-2.5.10以上版本)
# make
# makeinstall
wget http://cn2.php.net/distributions/php-5.2.6.tar.gz
tar zxvfphp-5.2.6.tar.gz
cd php-5.2.6
#./configure --prefix=/usr/local/php--with-apxs2=/usr/local/apache2/bin/apxs --with-jpeg-dir=/usr/local/jpeg6--with-png-dir=/usr/local/libpng2 --with-gd=/usr/local/gd2--with-freetype-dir=/usr/local/freetype2 --with-zlib-dir=/usr/local/zlib2-with-mysql=/usr/local/mysql--with-libxml-dir=/usr/local/libxml2 --enable-ftp--enable-mbstring --enable-exif --disable-ipv6
# make
# make install
# cp php.ini-dist /usr/local/php/lib/php.ini
六安装Zend
wget http://downloads.phpchina.com/zend/optimizer/3.3.3/ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz
#tar xzvf ZendOptimizer-3.3.3-linux-glibc23-i386.tar.gz
#./ZendOptimizer-3.3.3-linux-glibc21-i386/install.sh
安装ZendOptimizer过程的最后不要选择重启Apache。
七整合Apache与PHP
# vi /usr/local/apache2/conf/httpd.conf
找到:
AddTypeapplication/x-gzip .gz .tgz
在该行下面添加
AddType application/x-httpd-php.php
找到:

    DirectoryIndexindex.html

将该行改为

   DirectoryIndex index.html index.htmindex.php

找到:
#Includeconf/extra/httpd-mpm.conf
#Include conf/extra/httpd-info.conf
#Includeconf/extra/httpd-vhosts.conf
#Includeconf/extra/httpd-default.conf
去掉前面的“#”号,取消注释。
注意:以上 4个扩展配置文件中的设置请按照相关原则进行合理配置!
修改完成后保存退出。
# /usr/local/apache2/bin/apachectlrestart
六、查看确认L.A.M.P环境信息
在网站根目录放置 phpinfo.php 脚本,。
#viphpinfo.php

通过检查phpinfo中的各项信息是否正确
http://ip地址/phpinfo.php
页: [1]
查看完整版本: centos 4.5(32位服务器)+php+apache+zend+mysql环境架构