快速业务通道

linux下的Apache2 mysql5 php5 源码完整安装详解

作者 佚名技术 来源 Linux系统 浏览 发布时间 2012-04-21
ir -p /usr/local/gd2
# cd gd-(version)
# ./configure --prefix=/usr/local/gd2 --with-jpeg=/usr/local/jpeg6 --with-zlib-dir=/usr/local/zlib --with-png=/usr/local/libpng --with-freetype=/usr/local/freetype
# make
# make install

e.安装Curl库
# cd /root/Software/
# tar -zxf curl-(version).tar.gz
# mkdir -p /usr/local/curl
# ./configure --prefix=/usr/local/curl
# make
# make install

四:安装apache2
# cd /roo/Software/
# tar -zvxf httpd-2.2.6.tar.gz
# cd httpd-2.2.6
# mkdir -p /usr/local/apache2
# ./configure --prefix=/usr/local/apache --enable-modules=so --enable-rewrite
# make
# make install
# /usr/local/apache2/bin/apachectl -k start //启动apahce
用浏览器查看http://localhost,得到it works,说明apache已经配置成功了.
# /usr/local/apache2/bin/apachectl -k stop //停止apache

五:安装php5,php5有libxml2支持!
a. 安装libxml2
# cd /root/Software/
# tar -zvxf libxml2-(version).tar.gz
# cd libxml2-(version)
# mkdir -p /usr/local/libxml2
# ./configure --prefix=/usr/local/libxml2
# make
# make install

b.安装 libxslt (可选安装,你可以不安装)
# cd /root/Software/
# tar -zvxf libxslt-(version).tar.gz
# mkdir -p /usr/local/libxslt
# cd libxslt-(version)
# ./configure --prefix=/usr/local/libxslt --with-libxml-prefix=/usr/local/libxml2
# make
# make install

c.安装php5
# cd /root/Software/
# tar -zvxf php-(version).tar.gz
# mkdir -p /usr/local/php5
# cd php-(version)
# ./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs
>--with-gd=/usr/local/gd2 --with-jpeg-dir=/usr/local/jpeg6
>--with-zlib-dir=/usr/local/zlib
>--with-png-dir=/usr/local/libpng
>--with-freetype-dir=/usr/local/freetype -
>--enable-trace-vars --with-mysql=/usr/local/mysql
>--enable-mbstring=all --with-curl=/usr/local/curl --enable-mbregex
>--with-config-file-path=/usr/local/php5 --enable-ftp
>--enable-soap --with-xsl=/usr/local/libxslt

# make
# make install
# cp php.ini-dist /usr/local/php5/php.ini (别忘记了呵呵)


六:重新配置apache2让他支持php

# cd /usr/local/apache2/conf
# vim httpd.conf
在LoadModule php5_module modules/libphp5.so
添加AddType application/x-httpd-php .php


<IfModule mod_php5.c>
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php .phtml .php3
AddType application/x-httpd-php-source .phps
</IfModule>



OK,基本的安装已经完成.
重新起动APACHE:
# /usr/local/apache2/bin/apachectl start
如果重新起动APACHE出现:
Syntax error on line 232 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/libphp5.so into server:
/usr/local/apache2/modules/libphp4.so: cannot restore segment prot after reloc: Permission denied
那就要按照下面的方法解决:

1.chcon -t texrel_shlib_t /usr/local/apache2/modules/*.so

2.编辑/etc/selinux/config,找到这段:
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=enforcing

把 SELINUX=enforcing 注释掉:#S

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号