<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Erick &#187; apache</title>
	<atom:link href="http://blog.xiongchuan.org/tag/apache/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.xiongchuan.org</link>
	<description>Even a great life is only a life until you make it.</description>
	<lastBuildDate>Thu, 10 Mar 2011 14:44:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
	
<!-- Start Of Script Generated By WP-PostViews Plus -->
<script type='text/javascript' src='http://blog.xiongchuan.org/wp-includes/js/jquery/jquery.js?ver=1.4.4'></script>
<script type="text/javascript">
/* <![CDATA[ */
/* ]]> */
</script>
<!-- End Of Script Generated By WP-PostViews Plus -->
	<item>
		<title>CentOS 5.3搭建Apache2.2.4+Mysql5.1.4+PHP5.3服务器</title>
		<link>http://blog.xiongchuan.org/centos-5-3-apache2-mysql5-php-5-3-server.html</link>
		<comments>http://blog.xiongchuan.org/centos-5-3-apache2-mysql5-php-5-3-server.html#comments</comments>
		<pubDate>Sun, 08 Nov 2009 06:37:29 +0000</pubDate>
		<dc:creator>Erick</dc:creator>
				<category><![CDATA[Linux相关]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[服务器]]></category>

		<guid isPermaLink="false">http://www.pigblog.net/?p=381</guid>
		<description><![CDATA[留着，仅供自己下次安装用。都是在网上找的方法，只是给组合了下。 (温馨提示:如果你复制的安装过程，可能有类似这样的错误: configure: warning: /usr/local/php:: invalid host type &#8230; configure: error: can only configure for one host and one target at a time 我写的是&#8211;with-前面是两个-，但是wp经过了处理变成一个-了，所以你在记事本里面把-替换成两个-就行了 ) 1、使用 yum 程序安装所需开发包（以下为标准的 RPM 包名称） # yum install gcc gcc-c++ gcc-g77 flex bison autoconf automake bzip2-devel zlib-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel # 这里我们将编译GD所必须的一些小软件比如libpng,libtiff,freetype,libjpeg等先用RPM的方式一并安装好，避免手动编译浪费时间，同时也能避免很多错误，这几个小软件的编译很麻烦。这几个小软件编译错误了，GD当然安装不了，php5的编译当然也没戏了。所以我们抓大放小，对这些小牛鬼蛇神采取快速简洁的方式进行安装。并且对服务器的性能也不能产生什么影响。 2、源码编译安装所需包 (Source) (1) GD2 # [...]]]></description>
			<content:encoded><![CDATA[<p>留着，仅供自己下次安装用。都是在网上找的方法，只是给组合了下。<br />
<span style="color: #ff0000;">(温馨提示:如果你复制的安装过程，可能有类似这样的错误:<br />
configure: warning: /usr/local/php:: invalid host type<br />
&#8230;<br />
configure: error: can only configure for one host and one target at a time<br />
<span style="color: #000000;">我写的是<span style="color: #ff0000;">&#8211;with-</span>前面是<span style="color: #ff0000;">两个-</span>，但是wp经过了处理变成<span style="color: #ff0000;">一个-</span>了，所以你在记事本里面把<span style="color: #ff0000;">-</span>替换成<span style="color: #ff0000;">两个-</span>就行了</span><br />
)</span></p>
<p>1、使用 yum 程序安装所需开发包（以下为标准的 RPM 包名称）<br />
# yum install gcc gcc-c++ gcc-g77 flex bison autoconf automake bzip2-devel zlib-devel ncurses-devel libjpeg-devel libpng-devel libtiff-devel freetype-devel pam-devel</p>
<p># 这里我们将编译GD所必须的一些小软件比如libpng,libtiff,freetype,libjpeg等先用RPM的方式一并安装好，避免手动编译浪费时间，同时也能避免很多错误，这几个小软件的编译很麻烦。这几个小软件编译错误了，GD当然安装不了，php5的编译当然也没戏了。所以我们抓大放小，对这些小牛鬼蛇神采取快速简洁的方式进行安装。并且对服务器的性能也不能产生什么影响。</p>
<p>2、源码编译安装所需包 (Source)<br />
(1) GD2<br />
# cd /usr/local/src<br />
# wget http://www.boutell.com/gd/http/gd-2.0.33.tar.gz<br />
# tar xzvf gd-2.0.33.tar.gz<br />
# cd gd-2.0.33<br />
# ./configure &#8211;prefix=/usr/local/gd2 &#8211;mandir=/usr/share/man //./configure 配置。<br />
# make //make 是用来编译的，它从 Makefile 中读取指令，然后编译。<br />
# make install //make install 是用来安装的，它也从 Makefile 中读取指令，安装到指定的位置。</p>
<p>(2) Apache 日志截断程序<br />
# cd /usr/local/src<br />
# wget http://cronolog.org/download/cronolog-1.6.2.tar.gz<br />
# tar xzvf cronolog-1.6.2.tar.gz<br />
# cd cronolog-1.6.2<br />
# ./configure &#8211;prefix=/usr/local/cronolog<br />
# make<br />
# make install</p>
<p>(3) libxml 库程序<br />
# cd /usr/local/src<br />
# wget http://ftp.gnome.org/pub/gnome/sources/libxml2/2.6/libxml2-2.6.26.tar.gz<br />
# tar zxvf libxml2-2.6.26.tar.gz<br />
# cd libxml2-2.6.26<br />
# ./configure &#8211;prefix=/usr/local/libxml2<br />
# make<br />
# make install<br />
<span id="more-381"></span><br />
接下来进入正题，建议安装顺序Mysql,Apache,PHP<br />
3、本来想尝试用编译源码的方法安装Mysql，可是官主的5.1.4没有，就下载了5.1.3的，可是尝试装到非默认路径怎么都是出错，没办法就用了5.1.4的按照解压包里的INSTALL的提示，一步步安装到了/usr/local/mysql，挺简单。<br />
# useradd mysql //添加 mysql 用户<br />
# cd /usr/local/mysql<br />
# ./bin/mysql_install_db &#8211;user=mysql<br />
# chown -R root:mysql . //设置权限，注意后面有一个 &#8220;.&#8221;<br />
# chown -R mysql /var/lib/mysql //设置 mysql 目录权限<br />
# chgrp -R mysql . //注意后面有一个 &#8220;.&#8221;<br />
# cp share/mysql/my-medium.cnf /etc/my.cnf<br />
# cp share/mysql/mysql.server /etc/rc.d/init.d/mysqld //开机自动启动 mysql。<br />
# chmod 755 /etc/rc.d/init.d/mysqld<br />
# chkconfig &#8211;add mysqld</p>
<p>4、编译安装 Apache2.24<br />
这个最简单了，基本不会有错误发生。<br />
# tar zxvf httpd-2.2.4.tar.gz<br />
# cd httpd-2.2.4<br />
依次安装apr和apr-util（这两个文件夹在httpd-2.2.4/srclib/里面，如下操作）</p>
<p># cd srclib/apr<br />
# ./configure &#8211;prefix=/usr/local/apr &#8211;enable-threads &#8211;enable-other-child USE=ipv6<br />
# make &amp;&amp; make install</p>
<p># cd ../apr-util<br />
# ./configure &#8211;prefix=/usr/local/apr-util &#8211;with-apr=/usr/local/apr/ &#8211;with-mysql=/usr/local/mysql<br />
# make &amp;&amp; make install</p>
<p>yum install openssl-devel.x86_64</p>
<p>cd /usr/local/src/httpd-2.2.4<br />
./configure &#8211;prefix=/usr/local/apache2 &#8211;enable-mods-shared=all &#8211;enable-deflate=shared &#8211;with-mysql=/usr/local/mysql &#8211;enable-cache &#8211;enable-file-cache &#8211;enable-mem-cache &#8211;enable-disk-cache &#8211;enable-static-support &#8211;enable-static-htpasswd &#8211;enable-static-htdigest &#8211;enable-static-rotatelogs &#8211;enable-static-logresolve &#8211;enable-static-htdbm &#8211;enable-static-ab &#8211;enable-static-checkgid &#8211;disable-cgid &#8211;disable-cgi &#8211;with-mpm=worker &#8211;with-apr=/usr/local/apr/ &#8211;with-apr-util=/usr/local/apr-util/ &#8211;enable-ssl &#8211;with-ssl=/usr/include/openssl</p>
<p># make<br />
# make install<br />
# echo &#8216;/usr/local/apache2/bin/apachectl start &#8216; &gt;&gt; /etc/rc.local //将 apachectl 的调用加入到你的系统启动文件中。</p>
<p>注解：<br />
./configure //配置源代码树<br />
&#8211;prefix=/usr/local/apache2 //体系无关文件的顶级安装目录PREFIX ，也就Apache的安装目录。<br />
&#8211;enable-module=so //打开 so 模块，so 模块是用来提 DSO 支持的 apache 核心模块<br />
&#8211;enable-mods-shared=all //编译全部的模板，对于不需要我们可以在httpd.conf去掉。<br />
&#8211;enable-cache //支持缓存<br />
&#8211;enable-file-cache //支持文件缓存<br />
&#8211;enable-mem-cache //支持记忆缓存<br />
&#8211;enable-disk-cache //支持磁盘缓存<br />
&#8211;enable-static-support //支持静态连接(默认为动态连接)<br />
&#8211;enable-static-htpasswd //使用静态连接编译 htpasswd &#8211; 管理用于基本认证的用户文件<br />
&#8211;enable-static-htdigest //使用静态连接编译 htdigest &#8211; 管理用于摘要认证的用户文件<br />
&#8211;enable-static-rotatelogs //使用静态连接编译 rotatelogs &#8211; 滚动 Apache 日志的管道日志程序<br />
&#8211;enable-static-logresolve //使用静态连接编译 logresolve &#8211; 解析 Apache 日志中的IP地址为主机名<br />
&#8211;enable-static-htdbm //使用静态连接编译 htdbm &#8211; 操作 DBM 密码数据库<br />
&#8211;enable-static-ab //使用静态连接编译 ab &#8211; Apache HTTP 服务器性能测试工具<br />
&#8211;enable-static-checkgid //使用静态连接编译 checkgid<br />
&#8211;disable-cgid //禁止用一个外部 CGI 守护进程执行CGI脚本<br />
&#8211;disable-cgi //禁止编译 CGI 版本的 PHP<br />
&#8211;with-mpm=worker // 让apache以worker方式运行<br />
&#8211;enable-ssl // 编译 ssl模块。</p>
<p>将apache设置成开机自启动:</p>
<p>在/etc/rc.d/rc.local文件中加入一行<br />
/usr/local/apache2/bin/apachectl start<br />
这样每次重新启动系统以后,apache也会随系统一起启动.</p>
<p>或者<br />
# cp /usr/local/apache2/bin/apachectl /etc/rc.d/init.d/httpd<br />
然后 vi /etc/rc.d/init.d/httpd 添加(#!/bin/sh下面)<br />
# chkconfig: 2345 10 90<br />
# description: Activates/Deactivates Apache Web Server<br />
最后，运行chkconfig把Apache添加到系统的启动服务组里面：<br />
# chkconfig &#8211;add httpd<br />
# chkconfig httpd on</p>
<p>5、编译安装php5.3<br />
下载curl 安装到/usr/loca/curl<br />
./configure &#8211;prefix=/usr/local/php &#8211;with-apxs2=/usr/local/apache2/bin/apxs &#8211;with-zlib-dir &#8211;with-bz2 &#8211;with-tiff-dir &#8211;with-libxml-dir=/usr/local/libxml2 &#8211;with-gd=/usr/local/gd2 &#8211;with-freetype-dir &#8211;with-jpeg-dir &#8211;with-png-dir &#8211;with-ttf &#8211;enable-mbstring &#8211;with-mysql=/usr/local/mysql &#8211;with-mysqli=/usr/local/mysql/bin/mysql_config &#8211;with-config-file-path=/etc &#8211;with-iconv &#8211;disable-ipv6 &#8211;enable-static &#8211;enable-maintainer-zts &#8211;enable-memory-limit &#8211;enable-zend-multibyte &#8211;enable-inline-optimization  &#8211;enable-sockets &#8211;enable-soap &#8211;with-openssl &#8211;with-curl=/usr/local/curl</p>
<p># make</p>
<p># make install</p>
<p># cp php.ini-recommended /etc/php.ini</p>
<p>6、整合apache 与php<br />
# vi /usr/local/apache2/conf/httpd.conf<br />
在最后一行加上：<br />
AddType application/x-httpd-php .php</p>
<p>查找：(设置 WEB 默认文件)<br />
DirectoryIndex index.html<br />
替换为：<br />
DirectoryIndex index.php index.html index.htm //在 WEB 目录不到默认文件，httpd 就会执行 /var/www/error/noindex.html</p>
<p>找到这一段：<br />
# AllowOverride controls what directives may be placed in .htaccess files.<br />
# It can be &#8220;All&#8221;, &#8220;None&#8221;, or any combination of the keywords:<br />
# Options FileInfo AuthConfig Limit<br />
#<br />
AllowOverride none</p>
<p>更改为AllowOverride all<br />
允许apache rewrite</p>
<p># 监听443端口,支持https连接<br />
取消注释 httpd.conf 中的 Include conf/extra/httpd-ssl.conf</p>
<p>保存httpd.conf，退出。</p>
<p># /usr/local/apache2/bin/apachectl restart //重启 Apache</p>
<p>以上就完成了，因为我用到的东西比较简单，所以这是最基本的安装了。</p>
<h4  class="entry-title">Related Posts</h4><ul class="related_post"><li><a href="http://blog.xiongchuan.org/mysql-error-1045-28000-access-denied-for-user-rootlocalhost.html" title="Mysql ERROR 1045 (28000): Access denied for user &#8216;root&#8217;@'localhost&#8217;">Mysql ERROR 1045 (28000): Access denied for user &#8216;root&#8217;@'localhost&#8217;</a></li><li><a href="http://blog.xiongchuan.org/batch-delete-blank-lines.html" title="PHP批量删除空行|wordpress迁移的艰辛">PHP批量删除空行|wordpress迁移的艰辛</a></li><li><a href="http://blog.xiongchuan.org/cant-find-messagefile-resolve.html" title="MySQL Can&#8217;t find messagefile,解决方法">MySQL Can&#8217;t find messagefile,解决方法</a></li><li><a href="http://blog.xiongchuan.org/mysql-find-and-delete-duplicate-records.html" title="mysql 查找重复记录 删除重复记录">mysql 查找重复记录 删除重复记录</a></li><li><a href="http://blog.xiongchuan.org/warning-strtotime-function-strtotime-it-is-not-safe-to-rely-on-the-system-timezone-settings-resolve.html" title="Warning: strtotime() [function.strtotime]: It is not safe to rely on the system’s timezone settings. 解决方法">Warning: strtotime() [function.strtotime]: It is not safe to rely on the system’s timezone settings. 解决方法</a></li><li><a href="http://blog.xiongchuan.org/centos-eclipse-gbk-encoding.html" title="CentOS下eclipse支持GBK编码">CentOS下eclipse支持GBK编码</a></li><li><a href="http://blog.xiongchuan.org/dual-system-boot-grub-resolve.html" title="双系统开机进入GRUB的解决办法">双系统开机进入GRUB的解决办法</a></li><li><a href="http://blog.xiongchuan.org/centos-5-3-filezilla-ftp.html" title="CentOS5.3安装Filezilla FTP软件">CentOS5.3安装Filezilla FTP软件</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://blog.xiongchuan.org/centos-5-3-apache2-mysql5-php-5-3-server.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

