知识屋:更实用的电脑技术知识网站
所在位置:首页 > 操作系统 > linux

CentOS 5.5安装Apache2.2.6 mysql5.1.51 PHP5.2.14

发布时间:2014-09-05 17:20:20作者:知识屋

一、Apache安装
下载apache (http://httpd.apache.org/)到tmp
解压,tar –zxvf httpd-2.2.6.tar.gz
cd httpd-2.2.6
mkdir /usr/local/apache2
./configure --prefix=/usr/local/apache2 --enable-so --enable-mods-shared=all --enable-rewrite --enable-cache


make
make install
安装apache完成,输入命令 #/usr/local/apache2/bin/apachectl -k start
启动Apache
service httpd start


二、Mysql安装
到这里下载mysql RPM(service和client),
MySQL-server-community-5.1.51-1.rhel5.i386.rpm 安装服务端
MySQL-client-community-5.1.51-1.rhel5.i386.rpm 安装客户端
MySQL-devel-community-5.1.51-1.rhel5.i386.rpm 用于php的mysql安装
rpm –ivh MySQL-server-community-5.1.51-1.rhel5.i386.rpm
rpm –ivh MySQL-client-community-5.1.51-1.rhel5.i386.rpm
rpm –ivh MySQL-devel-community-5.1.51-1.rhel5.i386.rpm

三、 PHP准备的tar包安装
安装php之前要准备:
curl-7.15.0.tar.gz
freetype-2.3.5.tar.gz
gd-2.0.35.tar.gz
gettext-0.16.1.tar.gz
jpegsrc.v6b.tar.gz
libpng-1.2.31.tar.bz2
libxml2-2.6.31.tar.gz
t1lib-5.0.0.tar.gz
tiff-3.8.2.tar.gz
zlib-1.2.3.tar.gz

3.1 安装curl-7.15.0.tar.gz
#tar zxvf curl-7.15.0.tar.gz
#cd curl-7.15.0
#mkdir /usr/local/crul
#./configure --prefix=/usr/local/curl
#make clean
#make
#make install
3.2 jpegsrc.v6b.tar.gz
#mkdir -pv /usr/local/jpeg/{,bin,lib,include,man/man1,man1}
#./configure --prefix=/usr/local/jpeg --enable-shared --enable-static
#make clean
#make
#make install
3.3 libxml2-2.6.31.tar.gz
#tar zxvf libxml2-2.6.31.tar.gz
#cd libxml2
#mkdir usr/local/libxml2
#./configure --prefix=/usr/local/libxml2
#make clean
#make(时间可能稍长些)
#make install
#cp xml2-config /usr/bin
3.4 PDFlib-7.0.3-Linux-php.tar.gz
#tar xvf PDFlib-7.0.3-Linux-php.tar.gz
#cd pdflib
#cp bind/php5/php520mt/libpdf-php.so /usr/local/lib/
(上面的php520mt目录的同级目录中有php503,php510,php520目录,不知道是不是版本的区别)
3.5 t1lib-5.0.0.tar.gz
#tar zxvf t1lib-5.0.0.tar.gz
#cd t1lib
#mkdir /usr/local/t1lib
#./configure --prefix=/usr/local/t1lib
#make without-doc
#make install
3.6 freetype-2.3.5.tar.gz
#tar zxvf freetype-2.3.5.tar.gz
#cd freetype
# mkdir /usr/local/freetype
#./configure --prefix=/usr/local/freetype
#make clean
#make
#make install
3.7 zlib-1.2.3.tar.gz
#tar zxvf zlib-1.2.3.tar.gz
#cd zlib-1.2.3
#./configure --shared
#make clean
#make
#make install
3.8 libpng-1.2.26.tar.gz
#tar zxvf libpng-1.2.26.tar.gz
#cd libpng
#cp scripts/makefile.linux ./makefile
#mkdir /usr/local/libpng
#./configure --prefix=/usr/local/libpng
#make clean
#make
#make install
3.9 gettext-0.16.tar.gz
#tar zxvf gettext-0.16.tar.gz
#cd gettext
#mkdir /usr/local/gettext
#./configure --prefix=/usr/local/gettext
#make clean
#make
#make install(时间稍长)
3.10 gd-2.0.35.tar.gz
#tar zxvf gd-2.0.35.tar.gz
#cd gd
#./configure --with-png=/usr/local/lib --with-zlib=/usr/local/lib --with-freetype=/usr/local/freetype/lib --with-jpeg=/usr/local/jpeg/lib
#make clean
#make
#make install四、安装PHP
下载php-5.2.14
tar gxvf php-5.2.14.tar.bz2
cd php-5.2.14
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2/bin/apxs --enable-track-vars --with-sockets --enable-sockets --with-sysvshm --with-sysvsem --with-pdflib-dir=/usr/local/lib --with-jpeg-dir=/usr/local/jpeg --with-png-dir=/usr/local/lib --enable-mbstring=all --with-zlib-dir=/usr/local/lib --with-freetype-dir=/usr/local/freetype --with-curl=/usr/local/curl --with-libxml-dir=/usr/local/libxml2/lib --with-gettext=/usr/local/gettext/lib --with-gd --with-mysql=/usr --with-mysqli=/usr/bin/mysql_config
#make clean
#make
#make test
# make install
Php.ini文件的修改
#cp php.ini-production /usr/local/lib/php.ini
#vi /usr/local/lib/php.ini
查找修改extension_dir=./的内容(如下)
extension_dir = /usr/local/lib
添加PHP的环境变量:
临时的 #export PATH=$PATH:/usr/local/php/bin
永久性的:在/etc下有个profile的文件,将其打开把“export PATH=$PATH:/usr/local/php/bin”这句放在“export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC”的上一行
立即生效环境配置,不需要重启,用下命令:
. /etc/profile

五、修改apache配置文件httpd.conf
#vi /usr/local/apache2/conf/httpd.conf
查找AddType 大约在DefaultType text/plain
<IfModule mime_module>
输入如下内容
AddType application/x-httpd-php .htm
AddType application/x-httpd-php .html
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php .php
(不清楚是不是必须输入这么多项)
查找DirectoryIndex index.html 在其后输入 index.php
查找确保有如下两行配置:
LoadModule php5_module modules/libphp5.so
LoadModule rewrite_module modules/mod_rewrite.so
保存文件,退出。

 
(免责声明:文章内容如涉及作品内容、版权和其它问题,请及时与我们联系,我们将在第一时间删除内容,文章内容仅供参考)
收藏
  • 人气文章
  • 最新文章
  • 下载排行榜
  • 热门排行榜