<?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>网邻&#039;s Blog &#187; Apache</title>
	<atom:link href="http://anywang.vicp.net/wp/?cat=9&#038;feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://anywang.vicp.net:8180/wp</link>
	<description>一个信息技术教师的blog</description>
	<lastBuildDate>Tue, 14 Mar 2023 02:19:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
	
<!-- Start Of Script Generated By WP-PostViews Plus -->
<script type='text/javascript' src='http://anywang.vicp.net:8180/wp/wp-includes/js/jquery/jquery.js?ver=1.4.2'></script>
<script type="text/javascript">
/* <![CDATA[ */
/* ]]> */
</script>
<!-- End Of Script Generated By WP-PostViews Plus -->
	<item>
		<title>配置apache以fastcgi运行php</title>
		<link>http://anywang.vicp.net:8180/wp/?p=257</link>
		<comments>http://anywang.vicp.net:8180/wp/?p=257#comments</comments>
		<pubDate>Tue, 24 Jul 2012 12:12:45 +0000</pubDate>
		<dc:creator>网邻</dc:creator>
				<category><![CDATA[Apache]]></category>

		<guid isPermaLink="false">http://anywang.vicp.net/wp/?p=257</guid>
		<description><![CDATA[apache默认是用自带的mod_php模块运行php，现在我们介绍使用fastcgi来执行php脚本。先说下fastcgi的优点： Fastcgi的优点： 从稳定性上看, fastcgi是以独立的进程池运行来cgi,单独一个进程死掉,系统可以很轻易的丢弃,然后重新分 配新的进程来运行逻辑. · 从安全性上看,Fastcgi支持分布式运算. fastcgi和宿主的server完全独立, fastcgi怎么down也不会把server搞垮. · 从性能上看, fastcgi把动态逻辑的处理从server中分离出来, 大负荷的IO处理还是留给宿主server, 这样宿主server可以一心一意作IO,对于一个普通的动态网页来说, 逻辑处理可能只有一小部分, 大量的图片等静态 IO处理完全不需要逻辑程序的参与. · 从扩展性上讲, fastcgi是一个中立的技术标准, 完全可以支持任何语言写的处理程序 (php,java,perl,ruby,c++,python…) · 适用操作系统,可在任何平台上http://www.fastcgi.com/dist/mod_fastcgi-current.tar.gz使用 安装apache wget http://apache.ziply.com//httpd/httpd-2.2.21.tar.gz tar xzf httpd-2.2.21.tar.gz cd httpd-2.2.21 ./configure &#8211;prefix=/usr/local/apache make &#38;&#38; make install 安装fastcgi wget http://www.fastcgi.com/dist/mod_fastcgi-2.4.6.tar.gz tar xzf mod_fastcgi-2.4.6.tar.gz cd mod_fastcgi-2.4.6 cp Makefile.AP2 Makefile make top_dir=/usr/local/apache make top_dir=/usr/local/apache install 完成之后编辑httpd.conf配置文件，加入fastcgi模块装载代码： [...]]]></description>
			<content:encoded><![CDATA[<p><a title="apache" href="http://www.centos.bz/category/web-server/apache/">apache</a>默认是用自带的mod_php模块运行php，现在我们介绍使用fastcgi来执行php脚本。先说下fastcgi的优点：<br />
Fastcgi的优点：</p>
<li>从稳定性上看, fastcgi是以独立的进程池运行来cgi,单独一个进程死掉,系统可以很轻易的丢弃,然后重新分 配新的进程来运行逻辑.</li>
<li>· 从安全性上看,Fastcgi支持分布式运算. fastcgi和宿主的server完全独立, fastcgi怎么down也不会把server搞垮.</li>
<li>· 从性能上看, fastcgi把动态逻辑的处理从server中分离出来, 大负荷的IO处理还是留给宿主server, 这样宿主server可以一心一意作IO,对于一个普通的动态网页来说, 逻辑处理可能只有一小部分, 大量的图片等静态</li>
<li>IO处理完全不需要逻辑程序的参与.</li>
<li>· 从扩展性上讲, fastcgi是一个中立的技术标准, 完全可以支持任何语言写的处理程序 (php,java,perl,ruby,c++,python…)</li>
<li>· 适用操作系统,可在任何平台上http://www.fastcgi.com/dist/mod_fastcgi-current.tar.gz使用<br />
<h3 id="安装apache">安装apache</h3>
<ol title="Double click to hide line number.">wget http://apache.ziply.com//httpd/httpd-2.2.21.tar.gz</p>
<li>tar xzf httpd-2.2.21.tar.gz</li>
<li>cd httpd-2.2.21</li>
<li>./configure &#8211;prefix=/usr/local/apache</li>
<li>make &amp;&amp; make install</li>
</ol>
<h3 id="安装fastcgi">安装fastcgi</h3>
<ol title="Double click to hide line number.">wget http://www.fastcgi.com/dist/mod_fastcgi-2.4.6.tar.gz</p>
<li>tar xzf mod_fastcgi-2.4.6.tar.gz</li>
<li>cd mod_fastcgi-2.4.6</li>
<li>cp Makefile.AP2 Makefile</li>
<li>make top_dir=/usr/local/apache</li>
<li>make top_dir=/usr/local/apache install</li>
</ol>
<p>完成之后编辑httpd.conf配置文件，加入fastcgi模块装载代码：</p>
<ol title="Double click to hide line number.">LoadModule fastcgi_module modules/mod_fastcgi.so</ol>
</li>
<h3 id="安装php5.2">安装php5.2</h3>
<ol title="Double click to hide line number.">wget http://us2.php.net/get/php-5.2.17.tar.gz/from/am.php.net/mirror</p>
<li>tar xzf php-5.2.17.tar.gz</li>
<li>cd php-5.2.17</li>
<li>./configure &#8211;prefix=/usr/local/php &#8211;enable-fastcgi &#8211;disable-cli</li>
<li>make &amp;&amp; make install</li>
</ol>
<h3 id="配置apache支持php">配置apache支持php</h3>
<p>编辑httpd.conf文件，加入如下代码：</p>
<ol title="Double click to hide line number.">### fastcgi ###</p>
<li>ScriptAlias /fcgi-bin/ &#8220;/usr/local/php/bin/&#8221;</li>
<li>AddHandler php-fastcgi .php</li>
<li>Action php-fastcgi /fcgi-bin/php-cgi</li>
<li>AddType application/x-httpd-php .php</li>
<li> </li>
<li>&lt;IfModule mod_fcgid.c&gt;</li>
<li>    AddHandler fcgid-script. .php .fcgi   ### 暂时只配置支持.php</li>
<li>    IdleTimeout 300</li>
<li>    ProcessLifeTime 1800</li>
<li>    MaxProcessCount 100</li>
<li>    DefaultMinClassProcessCount 3</li>
<li>    DefaultMaxClassProcessCount 8</li>
<li>    IPCConnectTimeout 15</li>
<li>    IPCCommTimeout 300</li>
<li>    MaxRequestsPerProcess 100</li>
<li>&lt;/IfModule&gt;</li>
<li>### fastcgi ###</li>
</ol>
<p>建立虚拟主机可以这样配置：</p>
<ol title="Double click to hide line number.">&lt;VirtualHost *:80&gt;</p>
<li> DocumentRoot /usr/local/apache/htdocs</li>
<li> ServerName localhost</li>
<li> Options +ExecCGI</li>
<li> AddHandler fastcgi-script .fcgi</li>
<li> AddType application/x-httpd-php .php</li>
<li> Action application/x-httpd-php /fcgi-bin/php-cgi</li>
<li> &lt;Directory /usr/local/apache/htdocs&gt;</li>
<li> Options Indexes ExecCGI</li>
<li> Order allow,deny</li>
<li> allow from all</li>
<li> &lt;/Directory&gt;</li>
<li>&lt;/VirtualHost&gt;</li>
</ol>
<p>详细的fastcgi指令配置请看：<a href="http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html" target="_blank">http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html</a></p>
<p>转载请注明文章来源：<a rel="bookmark" href="http://www.centos.bz/2011/12/configure-apache-run-php-as-fastcgi/">http://www.centos.bz/2011/12/configure-apache-run-php-as-fastcgi/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://anywang.vicp.net:8180/wp/?feed=rss2&#038;p=257</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>配置apache运行cgi程序</title>
		<link>http://anywang.vicp.net:8180/wp/?p=255</link>
		<comments>http://anywang.vicp.net:8180/wp/?p=255#comments</comments>
		<pubDate>Tue, 24 Jul 2012 12:10:14 +0000</pubDate>
		<dc:creator>网邻</dc:creator>
				<category><![CDATA[Apache]]></category>

		<guid isPermaLink="false">http://anywang.vicp.net/wp/?p=255</guid>
		<description><![CDATA[配置apache运行cgi程序可分为两种情况，一是ScriptAlias目录的CGI，二是ScriptAlias以外目录的CGI。 ScriptAlias目录的CGI ScriptAlias指令使Apache允许执行一个特定目录中的CGI程序。当客户端请求此特定目录中的资源时，Apache假定其中文件都是CGI程序并试图运行。 ScriptAlias指令形如： ScriptAlias /cgi-bin/ /usr/local/apache/cgi-bin/ ScriptAlias目录以外的CGI 由于安全原因，CGI程序通常被限制在ScriptAlias指定的目录中，如此，管理员就可以严格地控制谁可以使用CGI程序。但是，如果采取了恰当的安全方法措施，则没有理由不允许其他目录中的CGI程序运行。比如，你可能希望用户在UserDir指定的宿主目录中存放页面，而他们有自己的CGI程序，但无权存取cgi-bin目录，这样，就产生了运行其他目录中CGI程序的需求。 1、用Options显式地允许CGI的执行 可以在主服务器配置文件中，使用Options指令显式地允许特定目录中CGI的执行： &#60;Directory /usr/local/apache/htdocs/somedir&#62; Options +ExecCGI &#60;/Directory&#62; 上述指令使Apache允许CGI文件的执行。另外，还必须告诉服务器哪些文件是CGI文件。下面的AddHandler指令告诉服务器所有带有cgi或pl后缀的文件是CGI程序： AddHandler cgi-script cgi pl 2、.htaccess文件 .htaccess文件是针对目录进行配置的一种方法。Apache在提供一个资源时，会在此资源所在目录中寻找.htaccess文件，如果有，则使其中的指令生效。AllowOverride 指令决定了.htaccess文件是否有效，它指定了哪些指令可以出现在其中，或者根本不允许使用。为此，需要在主服务器配置中如此配置： AllowOverride Options 在.htaccess文件中，需要如此配置： Options +ExecCGI 以使Apache允许此目录中CGI程序的执行。 最后可以编写一个cgi程序测试，如： #!/usr/bin/perl print &#8220;Content-type: text/html\n\n&#8221;; print &#8220;Hello, World.&#8221;; 参考：http://lamp.linux.gov.cn/Apache/ApacheMenu/howto/cgi.html 转载请注明文章来源：http://www.centos.bz/2012/06/configure-apache-run-cgi/]]></description>
			<content:encoded><![CDATA[<p>配置<a title="apache" href="http://www.centos.bz/category/web-server/apache/">apache</a>运行cgi程序可分为两种情况，一是ScriptAlias目录的CGI，二是ScriptAlias以外目录的CGI。</p>
<h3 id="ScriptAlias目录的CGI">ScriptAlias目录的CGI</h3>
<p>ScriptAlias指令使Apache允许执行一个特定目录中的CGI程序。当客户端请求此特定目录中的资源时，Apache假定其中文件都是CGI程序并试图运行。<br />
ScriptAlias指令形如：</p>
<ol title="Double click to hide line number.">ScriptAlias /cgi-bin/ /usr/local/apache/cgi-bin/</ol>
<h3 id="ScriptAlias目录以外的CGI">ScriptAlias目录以外的CGI</h3>
<p>由于安全原因，CGI程序通常被限制在ScriptAlias指定的目录中，如此，管理员就可以严格地控制谁可以使用CGI程序。但是，如果采取了恰当的安全方法措施，则没有理由不允许其他目录中的CGI程序运行。比如，你可能希望用户在UserDir指定的宿主目录中存放页面，而他们有自己的CGI程序，但无权存取cgi-bin目录，这样，就产生了运行其他目录中CGI程序的需求。<br />
<strong>1、用Options显式地允许CGI的执行</strong><br />
可以在主服务器配置文件中，使用Options指令显式地允许特定目录中CGI的执行：</p>
<ol title="Double click to hide line number.">&lt;Directory /usr/local/apache/htdocs/somedir&gt;</p>
<li>Options +ExecCGI</li>
<li>&lt;/Directory&gt;</li>
</ol>
<p>上述指令使Apache允许CGI文件的执行。另外，还必须告诉服务器哪些文件是CGI文件。下面的AddHandler指令告诉服务器所有带有cgi或pl后缀的文件是CGI程序：</p>
<ol title="Double click to hide line number.">AddHandler cgi-script cgi pl</ol>
<p><strong>2、.htaccess文件</strong><br />
.htaccess文件是针对目录进行配置的一种方法。Apache在提供一个资源时，会在此资源所在目录中寻找.htaccess文件，如果有，则使其中的指令生效。AllowOverride 指令决定了.htaccess文件是否有效，它指定了哪些指令可以出现在其中，或者根本不允许使用。为此，需要在主服务器配置中如此配置：</p>
<ol title="Double click to hide line number.">AllowOverride Options</ol>
<p>在.htaccess文件中，需要如此配置：</p>
<ol title="Double click to hide line number.">Options +ExecCGI</ol>
<p>以使Apache允许此目录中CGI程序的执行。<br />
最后可以编写一个cgi程序测试，如：</p>
<ol title="Double click to hide line number.">#!/usr/bin/perl</p>
<li>print &#8220;Content-type: text/html\n\n&#8221;;</li>
<li>print &#8220;Hello, World.&#8221;;</li>
</ol>
<p>参考：<a href="http://lamp.linux.gov.cn/Apache/ApacheMenu/howto/cgi.html" target="_blank">http://lamp.linux.gov.cn/Apache/ApacheMenu/howto/cgi.html</a></p>
<p>转载请注明文章来源：<a rel="bookmark" href="http://www.centos.bz/2012/06/configure-apache-run-cgi/">http://www.centos.bz/2012/06/configure-apache-run-cgi/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://anywang.vicp.net:8180/wp/?feed=rss2&#038;p=255</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache web服务器压力测试工具ab(apache benchmark)</title>
		<link>http://anywang.vicp.net:8180/wp/?p=249</link>
		<comments>http://anywang.vicp.net:8180/wp/?p=249#comments</comments>
		<pubDate>Tue, 24 Jul 2012 12:05:41 +0000</pubDate>
		<dc:creator>网邻</dc:creator>
				<category><![CDATA[Apache]]></category>

		<guid isPermaLink="false">http://anywang.vicp.net/wp/?p=249</guid>
		<description><![CDATA[以前安装好APACHE总是不知道该如何测试APACHE的性能，现在总算找到一个测试工具了。就是APACHE自带的测试工具AB(apache benchmark).在APACHE的bin目录下。 格式： ./ab [options] [http://]hostname[:port]/path 参数： -n requests Number of requests to perform //在测试会话中所执行的请求个数。默认时，仅执行一个请求 -c concurrency Number of multiple requests to make //一次产生的请求个数。默认是一次一个。 -t timelimit Seconds to max. wait for responses //测试所进行的最大秒数。其内部隐含值是-n 50000。它可以使对服务器的测试限制在一个固定的总时间以内。默认时，没有时间限制。 -p postfile File containing data to POST //包含了需要POST的数据的文件. -T content-type Content-type header for POSTing //POST数据所使用的Content-type头信息。 -v verbosity How much troubleshooting info [...]]]></description>
			<content:encoded><![CDATA[<p>以前安装好<a title="APACHE" href="http://www.centos.bz/category/web-server/apache/">APACHE</a>总是不知道该如何测试APACHE的性能，现在总算找到一个测试工具了。就是APACHE自带的测试工具AB(apache benchmark).在APACHE的bin目录下。<br />
格式： ./ab [options] [http://]hostname[:port]/path<br />
参数：<br />
-n requests Number of requests to perform<br />
//在测试会话中所执行的请求个数。默认时，仅执行一个请求<br />
-c concurrency Number of multiple requests to make<br />
//一次产生的请求个数。默认是一次一个。<br />
-t timelimit Seconds to max. wait for responses<br />
//测试所进行的最大秒数。其内部隐含值是-n 50000。它可以使对服务器的测试限制在一个固定的总时间以内。默认时，没有时间限制。<br />
-p postfile File containing data to POST<br />
//包含了需要POST的数据的文件.<br />
-T content-type Content-type header for POSTing<br />
//POST数据所使用的Content-type头信息。<br />
-v verbosity How much troubleshooting info to print<br />
//设置显示信息的详细程度 – 4或更大值会显示头信息， 3或更大值可以显示响应代码(404, 200等), 2或更大值可以显示警告和其他信息。 -V 显示版本号并退出。<br />
-w Print out results in HTML tables<br />
//以HTML表的格式输出结果。默认时，它是白色背景的两列宽度的一张表。<br />
-i Use HEAD instead of GET<br />
// 执行HEAD请求，而不是GET。<br />
-x attributes String to insert as table attributes<br />
//<br />
-y attributes String to insert as tr attributes<br />
//<br />
-z attributes String to insert as td or th attributes<br />
//<br />
-C attribute Add cookie, eg. ‘Apache=1234. (repeatable)<br />
//-C cookie-name=value 对请求附加一个Cookie:行。 其典型形式是name=value的一个参数对。此参数可以重复。<br />
-H attribute Add Arbitrary header line, eg. ‘Accept-Encoding: gzip’<br />
Inserted after all normal header lines. (repeatable)<br />
-A attribute Add Basic WWW Authentication, the attributes<br />
are a colon separated username and password.<br />
-P attribute Add Basic Proxy Authentication, the attributes<br />
are a colon separated username and password.<br />
//-P proxy-auth-username:password 对一个中转代理提供BASIC认证信任。用户名和密码由一个:隔开，并以base64编码形式发送。无论服务器是否需要(即, 是否发送了401认证需求代码)，此字符串都会被发送。<br />
-X proxy:port Proxyserver and port number to use<br />
-V Print version number and exit<br />
-k Use HTTP KeepAlive feature<br />
-d Do not show percentiles served table.<br />
-S Do not show confidence estimators and warnings.<br />
-g filename Output collected data to gnuplot format file.<br />
-e filename Output CSV file with percentages served<br />
-h Display usage information (this message)<br />
//-attributes 设置 属性的字符串. 缺陷程序中有各种静态声明的固定长度的缓冲区。另外，对命令行参数、服务器的响应头和其他外部输入的解析也很简单，这可能会有不良后果。它没有完整地实现HTTP/1.x; 仅接受某些’预想’的响应格式。 strstr(3)的频繁使用可能会带来性能问题，即, 你可能是在测试ab而不是服务器的性能。<br />
参数很多,一般我们用 -c 和 -n 参数就可以了. 例如:<br />
./ab -c 1000 -n 1000 http://127.0.0.1/index.php<br />
这个表示同时处理1000个请求并运行1000次index.php文件.<br />
#/usr/local/xiaobai/apache2054/bin/ab -c 1000 -n 1000 http://127.0.0.1/index.html.zh-cn.gb2312<br />
This is ApacheBench, Version 2.0.41-dev &lt;$Revision: 1.121.2.12 $&gt; apache-2.0<br />
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/<br />
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/<br />
Benchmarking 127.0.0.1 (be patient)<br />
Completed 100 requests<br />
Completed 200 requests<br />
Completed 300 requests<br />
Completed 400 requests<br />
Completed 500 requests<br />
Completed 600 requests<br />
Completed 700 requests<br />
Completed 800 requests<br />
Completed 900 requests<br />
Finished 1000 requests</p>
<p>Server Software: Apache/2.0.54<br />
//平台apache 版本2.0.54<br />
Server Hostname: 127.0.0.1<br />
//服务器主机名<br />
Server Port: 80<br />
//服务器端口<br />
Document Path: /index.html.zh-cn.gb2312<br />
//测试的页面文档<br />
Document Length: 1018 bytes<br />
//文档大小<br />
Concurrency Level: 1000<br />
//并发数<br />
Time taken for tests: 8.188731 seconds<br />
//整个测试持续的时间<br />
Complete requests: 1000<br />
//完成的请求数量<br />
Failed requests: 0<br />
//失败的请求数量<br />
Write errors: 0</p>
<p>Total transferred: 1361581 bytes<br />
//整个场景中的网络传输量<br />
HTML transferred: 1055666 bytes<br />
//整个场景中的HTML内容传输量<br />
Requests per second: 122.12 [#/sec] (mean)<br />
//大家最关心的指标之一，相当于 LR 中的 每秒事务数 ，后面括号中的 mean 表示这是一个平均值<br />
Time per request: 8188.731 [ms] (mean)<br />
//大家最关心的指标之二，相当于 LR 中的 平均事务响应时间 ，后面括号中的 mean 表示这是一个平均值<br />
Time per request: 8.189 [ms] (mean, across all concurrent requests)<br />
//每个请求实际运行时间的平均值<br />
Transfer rate: 162.30 [Kbytes/sec] received<br />
//平均每秒网络上的流量，可以帮助排除是否存在网络流量过大导致响应时间延长的问题<br />
Connection Times (ms)<br />
min mean[+/-sd] median max<br />
Connect: 4 646 1078.7 89 3291<br />
Processing: 165 992 493.1 938 4712<br />
Waiting: 118 934 480.6 882 4554<br />
Total: 813 1638 1338.9 1093 7785<br />
//网络上消耗的时间的分解，各项数据的具体算法还不是很清楚<br />
Percentage of the requests served within a certain time (ms)<br />
50% 1093<br />
66% 1247<br />
75% 1373<br />
80% 1493<br />
90% 4061<br />
95% 4398<br />
98% 5608<br />
99% 7368<br />
100% 7785 (longest request)<br />
//整个场景中所有请求的响应情况。在场景中每个请求都有一个响应时间，其中50％的用户响应时间小于1093 毫秒，60％ 的用户响应时间小于1247 毫秒，最大的响应时间小于7785 毫秒<br />
由于对于并发请求，cpu实际上并不是同时处理的，而是按照每个请求获得的时间片逐个轮转处理的，所以基本上第一个Time per request时间约等于第二个Time per request时间乘以并发请求数<br />
转自：<a href="http://blog.chinaunix.net/space.php?uid=12318776&amp;do=blog&amp;cuid=537944" target="_blank">http://blog.chinaunix.net/space.php?uid=12318776&amp;do=blog&amp;cuid=537944</a></p>
<p>转载请注明文章来源：<a rel="bookmark" href="http://www.centos.bz/2011/10/apache-banchmark/">http://www.centos.bz/2011/10/apache-banchmark/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://anywang.vicp.net:8180/wp/?feed=rss2&#038;p=249</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux Apache开启gzip压缩提高网页下载速度</title>
		<link>http://anywang.vicp.net:8180/wp/?p=247</link>
		<comments>http://anywang.vicp.net:8180/wp/?p=247#comments</comments>
		<pubDate>Tue, 24 Jul 2012 12:03:33 +0000</pubDate>
		<dc:creator>网邻</dc:creator>
				<category><![CDATA[Apache]]></category>

		<guid isPermaLink="false">http://anywang.vicp.net/wp/?p=247</guid>
		<description><![CDATA[为了提高网页浏览速度，我们可以在服务器的apache开启gzip压缩功能，这样压缩使网页更小，自然下载需要的时间就更少了，用户体验更佳。下面来介绍如何开启这个功能。 1、首先得确认apache是否已经加载了mod_deflate模块。 httpd -M 如何此模块不在列表中，可以参考这篇文章：如何安装加载mod_deflate模块。 2、编译配置文件httpd.conf，增加支持gzip的文件类型，如下： &#60;Location /&#62; AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/atom_xml AddOutputFilterByType DEFLATE application/x-javascript AddOutputFilterByType DEFLATE application/x-httpd-php AddOutputFilterByType DEFLATE text/html &#60;/Location&#62; 3、重启httpd。 service httpd restart 4，检验是否已经开启成功。 可以到站长工具http://tool.chinaz.com/Gzips/输入网站的任一网址来测试。 转载请注明文章来源：http://www.centos.bz/2011/09/linux-apache-enable-gzip-speed-up-webpage/]]></description>
			<content:encoded><![CDATA[<p>为了提高网页浏览速度，我们可以在服务器的<a title="apache" href="http://www.centos.bz/category/web-server/apache/">apache</a>开启gzip压缩功能，这样压缩使网页更小，自然下载需要的时间就更少了，用户体验更佳。下面来介绍如何开启这个功能。<br />
1、首先得确认apache是否已经加载了mod_deflate模块。</p>
<ol title="Double click to hide line number.">httpd -M</ol>
<p>如何此模块不在列表中，可以参考这篇文章：<a title="Linux Apache安装加载mod_deflate模块" href="http://www.centos.bz/2011/09/linux-apache-install-mod-deflate-module/">如何安装加载mod_deflate模块</a>。<br />
2、编译配置文件httpd.conf，增加支持gzip的文件类型，如下：</p>
<ol title="Double click to hide line number.">&lt;Location /&gt;</p>
<li>AddOutputFilterByType DEFLATE text/plain</li>
<li>AddOutputFilterByType DEFLATE text/css</li>
<li>AddOutputFilterByType DEFLATE application/xml</li>
<li>AddOutputFilterByType DEFLATE application/rss+xml</li>
<li>AddOutputFilterByType DEFLATE application/atom_xml</li>
<li>AddOutputFilterByType DEFLATE application/x-javascript</li>
<li>AddOutputFilterByType DEFLATE application/x-httpd-php</li>
<li>AddOutputFilterByType DEFLATE text/html</li>
<li>&lt;/Location&gt;</li>
</ol>
<p>3、重启httpd。</p>
<ol title="Double click to hide line number.">service httpd restart</ol>
<p>4，检验是否已经开启成功。<br />
可以到站长工具http://tool.chinaz.com/Gzips/输入网站的任一网址来测试。</p>
<p>转载请注明文章来源：<a rel="bookmark" href="http://www.centos.bz/2011/09/linux-apache-enable-gzip-speed-up-webpage/">http://www.centos.bz/2011/09/linux-apache-enable-gzip-speed-up-webpage/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://anywang.vicp.net:8180/wp/?feed=rss2&#038;p=247</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux Apache安装加载mod_deflate模块</title>
		<link>http://anywang.vicp.net:8180/wp/?p=245</link>
		<comments>http://anywang.vicp.net:8180/wp/?p=245#comments</comments>
		<pubDate>Tue, 24 Jul 2012 12:02:44 +0000</pubDate>
		<dc:creator>网邻</dc:creator>
				<category><![CDATA[Apache]]></category>

		<guid isPermaLink="false">http://anywang.vicp.net/wp/?p=245</guid>
		<description><![CDATA[为了开启apache服务器中的gzip压缩功能，mod_deflate模块是必须安装加载的。现在介绍如何安装。 1、进入到mod_deflate.c目录 cd /lamp/httpd-2.2.20/modules/filters 2、执行编译加载程序 /usr/local/apache/bin/apxs -i -a -c mod_deflate.c 3、重新启动httpd程序 service httpd restart 4、查看是否已经加载成功 httpd -M 转载请注明文章来源：http://www.centos.bz/2011/09/linux-apache-install-mod-deflate-module/]]></description>
			<content:encoded><![CDATA[<p>为了开启<a title="apache" href="http://www.centos.bz/category/web-server/apache/">apache</a>服务器中的gzip压缩功能，mod_deflate模块是必须安装加载的。现在介绍如何安装。<br />
1、进入到mod_deflate.c目录</p>
<ol title="Double click to hide line number.">cd /lamp/httpd-2.2.20/modules/filters</ol>
<p>2、执行编译加载程序</p>
<ol title="Double click to hide line number.">/usr/local/apache/bin/apxs -i -a -c mod_deflate.c</ol>
<p>3、重新启动httpd程序</p>
<ol title="Double click to hide line number.">service httpd restart</ol>
<p>4、查看是否已经加载成功</p>
<ol title="Double click to hide line number.">httpd -M</ol>
<p>转载请注明文章来源：<a rel="bookmark" href="http://www.centos.bz/2011/09/linux-apache-install-mod-deflate-module/">http://www.centos.bz/2011/09/linux-apache-install-mod-deflate-module/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://anywang.vicp.net:8180/wp/?feed=rss2&#038;p=245</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CentOS Apache虚拟主机配置</title>
		<link>http://anywang.vicp.net:8180/wp/?p=240</link>
		<comments>http://anywang.vicp.net:8180/wp/?p=240#comments</comments>
		<pubDate>Tue, 24 Jul 2012 11:58:16 +0000</pubDate>
		<dc:creator>网邻</dc:creator>
				<category><![CDATA[Apache]]></category>

		<guid isPermaLink="false">http://anywang.vicp.net/wp/?p=240</guid>
		<description><![CDATA[对于不是使用虚拟主机控制面板的系统管理员，就必须手动配置apache的虚拟主机了，我们可以通过配置httpd.conf文件实现。 比如我们以IP192.168.0.3配置两个虚拟主机。 首先编辑 /etc/httpd/conf/httpd.conf配置文件 vi /etc/httpd/conf/httpd.conf 然后添加如下代码至文件底部： NameVirtualHost 192.168.0.3 &#60;virtualhost 192.168.0.3&#62; ServerAdmin  admin@example.com DocumentRoot  /var/www/html/website2 ServerName  www.website2.com ErrorLog  /var/www/html/website2/logs/error_log TransferLog  /var/www/html/website2/logs/access_log &#60;/virtualhost&#62; &#60;virtualhost 192.168.0.3&#62; ServerAdmin  admin@website3.com DocumentRoot  /var/www/html/website3 ServerName  www.website3.com ErrorLog  /var/www/html/website3/logs/error_log TransferLog  /var/www/html/website3/logs/access_log &#60;/virtualhost&#62; 如果你有多个IP，则继续按以上代码添加，只需要修改192.168.0.3成你的IP即可。 转载请注明文章来源：http://www.centos.bz/2011/04/centos-apache-virtual-host-configuration/]]></description>
			<content:encoded><![CDATA[<p>对于不是使用虚拟主机控制面板的系统管理员，就必须手动配置<a title="apache" href="http://www.centos.bz/category/web-server/apache/">apache</a>的虚拟主机了，我们可以通过配置httpd.conf文件实现。</p>
<p>比如我们以IP192.168.0.3配置两个虚拟主机。<br />
首先编辑 /etc/httpd/conf/httpd.conf配置文件</p>
<ol title="Double click to hide line number.">vi /etc/httpd/conf/httpd.conf</ol>
<p>然后添加如下代码至文件底部：</p>
<ol title="Double click to hide line number.">NameVirtualHost 192.168.0.3</p>
<li>&lt;virtualhost 192.168.0.3&gt;</li>
<li>ServerAdmin  admin@example.com</li>
<li>DocumentRoot  /var/www/html/website2</li>
<li>ServerName  www.website2.com</li>
<li>ErrorLog  /var/www/html/website2/logs/error_log</li>
<li>TransferLog  /var/www/html/website2/logs/access_log</li>
<li>&lt;/virtualhost&gt;</li>
<li>&lt;virtualhost 192.168.0.3&gt;</li>
<li>ServerAdmin  admin@website3.com</li>
<li>DocumentRoot  /var/www/html/website3</li>
<li>ServerName  www.website3.com</li>
<li>ErrorLog  /var/www/html/website3/logs/error_log</li>
<li>TransferLog  /var/www/html/website3/logs/access_log</li>
<li>&lt;/virtualhost&gt;</li>
</ol>
<p>如果你有多个IP，则继续按以上代码添加，只需要修改192.168.0.3成你的IP即可。</p>
<p>转载请注明文章来源：<a rel="bookmark" href="http://www.centos.bz/2011/04/centos-apache-virtual-host-configuration/">http://www.centos.bz/2011/04/centos-apache-virtual-host-configuration/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://anywang.vicp.net:8180/wp/?feed=rss2&#038;p=240</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CentOS 5.x yum安装LAMP(Apache+MySQL+PHP)</title>
		<link>http://anywang.vicp.net:8180/wp/?p=238</link>
		<comments>http://anywang.vicp.net:8180/wp/?p=238#comments</comments>
		<pubDate>Tue, 24 Jul 2012 11:56:35 +0000</pubDate>
		<dc:creator>网邻</dc:creator>
				<category><![CDATA[Apache]]></category>

		<guid isPermaLink="false">http://anywang.vicp.net/wp/?p=238</guid>
		<description><![CDATA[LAMP是Linux,Apache,MySQL,PHP的缩写。这个教程主要是讲在centos安装有php和mysql支持的apache web服务器。在这个教程我使用主机名server1.example.com对应IP地址192.168.0.100。这些设置可能不同于你，你必须替换成你正确的。 添加外部源，保证MySQL和PHP最新 因为系统基本的源的MySQL和PHP程序比较旧，所以我们添加比较新的外部源。 # rpm &#8211;import http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka # vi /etc/yum.repos.d/CentOS-Base.repo 在底部增加下面信息 [utterramblings] name=Jason&#8217;s Utter Ramblings Repo baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/ enabled=1 gpgcheck=1 gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka 安装MySQL 执行yum程序安装MySQL yum install mysql mysql-server 添加MySQL进启动项（这样系统启动时会自动启动MySQL)，并立即启动MySQL服务器： chkconfig &#8211;levels 235 mysqld on /etc/init.d/mysqld start 设置MySQL root帐号密码： mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL       SERVERS IN PRODUCTION [...]]]></description>
			<content:encoded><![CDATA[<p><a title="LAMP" href="http://www.centos.bz/tag/lamp/">LAMP</a>是<a title="Linux" href="http://www.centos.bz/tag/linux/">Linux</a>,<a title="Apache" href="http://www.centos.bz/category/web-server/apache/">Apache</a>,<a title="MySQL" href="http://www.centos.bz/category/mysql/">MySQL</a>,PHP的缩写。这个教程主要是讲在<a title="centos" href="http://www.centos.bz/">centos</a>安装有php和mysql支持的apache web服务器。在这个教程我使用主机名server1.example.com对应IP地址192.168.0.100。这些设置可能不同于你，你必须替换成你正确的。</p>
<h3 id="添加外部源，保证MySQL和PHP最新">添加外部源，保证MySQL和PHP最新</h3>
<p>因为系统基本的源的MySQL和PHP程序比较旧，所以我们添加比较新的外部源。</p>
<ol title="Double click to hide line number."># rpm &#8211;import http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka</p>
<li># vi /etc/yum.repos.d/CentOS-Base.repo</li>
</ol>
<p>在底部增加下面信息</p>
<ol title="Double click to hide line number.">[utterramblings]</p>
<li>name=Jason&#8217;s Utter Ramblings Repo</li>
<li>baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/</li>
<li>enabled=1</li>
<li>gpgcheck=1</li>
<li>gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka</li>
</ol>
<h3 id="安装MySQL">安装MySQL</h3>
<p>执行yum程序安装MySQL</p>
<ol title="Double click to hide line number.">yum install mysql mysql-server</ol>
<p>添加MySQL进启动项（这样系统启动时会自动启动MySQL)，并立即启动MySQL服务器：</p>
<ol title="Double click to hide line number.">chkconfig &#8211;levels 235 mysqld on</p>
<li>/etc/init.d/mysqld start</li>
</ol>
<p>设置MySQL root帐号密码：</p>
<ol title="Double click to hide line number.">mysql_secure_installation</ol>
<ol title="Double click to hide line number.">NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL</p>
<li>      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!</li>
<li> </li>
<li> </li>
<li>In order to log into MySQL to secure it, we&#8217;ll need the current</li>
<li>password for the root user.  If you&#8217;ve just installed MySQL, and</li>
<li>you haven&#8217;t set the root password yet, the password will be blank,</li>
<li>so you should just press enter here.</li>
<li> </li>
<li>Enter current password for root (enter for none):</li>
<li>OK, successfully used password, moving on&#8230;</li>
<li> </li>
<li>Setting the root password ensures that nobody can log into the MySQL</li>
<li>root user without the proper authorisation.</li>
<li> </li>
<li>Set root password? [Y/n] &lt;&#8211; ENTER</li>
<li>New password: &lt;&#8211; 你的MySQL root密码</li>
<li>Re-enter new password: &lt;&#8211; 你的MySQL root密码</li>
<li>Password updated successfully!</li>
<li>Reloading privilege tables..</li>
<li> &#8230; Success!</li>
<li> </li>
<li> </li>
<li>By default, a MySQL installation has an anonymous user, allowing anyone</li>
<li>to log into MySQL without having to have a user account created for</li>
<li>them.  This is intended only for testing, and to make the installation</li>
<li>go a bit smoother.  You should remove them before moving into a</li>
<li>production environment.</li>
<li> </li>
<li>Remove anonymous users? [Y/n] &lt;&#8211; ENTER</li>
<li> &#8230; Success!</li>
<li> </li>
<li>Normally, root should only be allowed to connect from &#8216;localhost&#8217;.  This</li>
<li>ensures that someone cannot guess at the root password from the network.</li>
<li> </li>
<li>Disallow root login remotely? [Y/n] &lt;&#8211; ENTER</li>
<li> &#8230; Success!</li>
<li> </li>
<li>By default, MySQL comes with a database named &#8216;test&#8217; that anyone can</li>
<li>access.  This is also intended only for testing, and should be removed</li>
<li>before moving into a production environment.</li>
<li> </li>
<li>Remove test database and access to it? [Y/n] &lt;&#8211; ENTER</li>
<li> - Dropping test database&#8230;</li>
<li> &#8230; Success!</li>
<li> - Removing privileges on test database&#8230;</li>
<li> &#8230; Success!</li>
<li> </li>
<li>Reloading the privilege tables will ensure that all changes made so far</li>
<li>will take effect immediately.</li>
<li> </li>
<li>Reload privilege tables now? [Y/n] &lt;&#8211; ENTER</li>
<li> &#8230; Success!</li>
<li> </li>
<li>Cleaning up&#8230;</li>
<li> </li>
<li> </li>
<li> </li>
<li>All done!  If you&#8217;ve completed all of the above steps, your MySQL</li>
<li>installation should now be secure.</li>
<li> </li>
<li>Thanks for using MySQL!</li>
</ol>
<h3 id="安装Apache">安装Apache</h3>
<p>Apache在CentOS软件包可用，因此我们可以使用yum安装：</p>
<ol title="Double click to hide line number.">yum install httpd</ol>
<p>设置系统启动时自启动Apache</p>
<ol title="Double click to hide line number.">chkconfig &#8211;levels 235 httpd on</ol>
<p>并启动Apache</p>
<ol title="Double click to hide line number.">/etc/init.d/httpd start</ol>
<p>现在你直接在你的浏览器键入http://192.168.0.100,你就应该会看到Apache的测试页面。</p>
<h3 id="安装PHP">安装PHP</h3>
<p>我们可以按照下面的命令安装PHP和Apache PHP模块：</p>
<ol title="Double click to hide line number.">yum install php</ol>
<p>然后重启Apache服务器:</p>
<ol title="Double click to hide line number.">/etc/init.d/httpd restart</ol>
<h3 id="安装相关模块使用PHP支持MySQL">安装相关模块使用PHP支持MySQL</h3>
<p>为了让PHP支持MySQL，我们可以安装php-mysql软件包。你也可以安装其它的php模块。可以使用以下命令搜索可用的php模块：</p>
<ol title="Double click to hide line number.">yum search php</ol>
<p>选择一些你需要的模块进行安装：</p>
<ol title="Double click to hide line number.">yum install php-mysql php-common php-mbstring php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc</ol>
<p>现在重启Apache:</p>
<ol title="Double click to hide line number.">/etc/init.d/httpd restart</ol>
<h3 id="安装phpMyAdmin">安装phpMyAdmin</h3>
<p><a title="phpMyAdmin" href="http://www.centos.bz/tag/phpmyadmin/">phpMyAdmin</a>是一个可视化管理你的MySQL数据库的软件。<br />
安装很简单,下载解压到根目录即可.<br />
下载地址:http://www.phpmyadmin.net/home_page/downloads.php<br />
接着我们配置phpMyAdmin，为了使用phpMyAdmin不仅仅只允许localhost连接，我们修改一下apache的配置。</p>
<ol title="Double click to hide line number.">vi /etc/httpd/conf.d/phpmyadmin.conf</ol>
<p>填入如下内容：</p>
<ol title="Double click to hide line number.">#</p>
<li>#  Web application to manage MySQL</li>
<li>#</li>
<li> </li>
<li>#&lt;Directory &#8220;/usr/share/phpmyadmin&#8221;&gt;</li>
<li>#  Order Deny,Allow</li>
<li>#  Deny from all</li>
<li>#  Allow from 127.0.0.1</li>
<li>#&lt;/Directory&gt;</li>
<li> </li>
<li>Alias /phpmyadmin /usr/share/phpmyadmin</li>
<li>Alias /phpMyAdmin /usr/share/phpmyadmin</li>
<li>Alias /mysqladmin /usr/share/phpmyadmin</li>
</ol>
<p>重启apache:<br />
/etc/init.d/httpd restart<br />
然后你就可以通过http://192.168.0.100/phpmyadmin/进入phpMyAdmin了。</p>
<p>转载请注明文章来源：<a rel="bookmark" href="http://www.centos.bz/2011/04/centos-yum-install-lamp-apache-mysql-php/">http://www.centos.bz/2011/04/centos-yum-install-lamp-apache-mysql-php/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://anywang.vicp.net:8180/wp/?feed=rss2&#038;p=238</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CentOS 源码编译安装LAMP(Apache MySQL PHP)</title>
		<link>http://anywang.vicp.net:8180/wp/?p=236</link>
		<comments>http://anywang.vicp.net:8180/wp/?p=236#comments</comments>
		<pubDate>Tue, 24 Jul 2012 11:53:34 +0000</pubDate>
		<dc:creator>网邻</dc:creator>
				<category><![CDATA[Apache]]></category>

		<guid isPermaLink="false">http://anywang.vicp.net/wp/?p=236</guid>
		<description><![CDATA[源码编译安装LAMP虽然过程繁琐，但可以根据自己PHP程序的需要配置相应的环境，非常的灵活。对于比较急于配置好LAMP的同学，可以使用lamp一键安装。 卸载yum或rpm安装的amp软件 在编译安装lamp之前，首先先卸载已存在的rpm包吧。 rpm -e httpd rpm -e mysql rpm -e php yum -y remove httpd yum -y remove php yum -y remove mysql-server mysql yum -y remove php-mysql 禁用SeLinux selinux可能会致使编译安装失败，我们先禁用它。 sed -i &#8216;s/SELINUX=enforcing/SELINUX=disabled/g&#8217; /etc/selinux/config //永久禁用，需要重启生效 setenforce 0 //临时禁用，不需要重启 yum安装必要工具 1、安装编译工具gcc gcc-c++make automake autoconf kernel-devel 2、安装PHP所需依赖，如libxml2-devel openssl-devel curl-devel libjpeg-devel libpng-devel等 yum -y install gcc gcc-c++  [...]]]></description>
			<content:encoded><![CDATA[<p>源码编译安装<a title="LAMP" href="http://www.centos.bz/tag/lamp/">LAMP</a>虽然过程繁琐，但可以根据自己PHP程序的需要配置相应的环境，非常的灵活。对于比较急于配置好LAMP的同学，可以使用<a href="http://www.centos.bz/tmp/">lamp一键安装</a>。</p>
<h3 id="卸载yum或rpm安装的amp软件">卸载yum或rpm安装的amp软件</h3>
<p>在编译安装lamp之前，首先先卸载已存在的rpm包吧。</p>
<ol title="Double click to hide line number.">rpm -e httpd</p>
<li>rpm -e mysql</li>
<li>rpm -e php</li>
<li>yum -y remove httpd</li>
<li>yum -y remove php</li>
<li>yum -y remove mysql-server mysql</li>
<li>yum -y remove php-mysql</li>
</ol>
<h3 id="禁用SeLinux">禁用SeLinux</h3>
<p>selinux可能会致使编译安装失败，我们先禁用它。</p>
<ol title="Double click to hide line number.">sed -i &#8216;s/SELINUX=enforcing/SELINUX=disabled/g&#8217; /etc/selinux/config //永久禁用，需要重启生效</p>
<li>setenforce 0 //临时禁用，不需要重启</li>
</ol>
<h3 id="yum安装必要工具">yum安装必要工具</h3>
<p>1、安装编译工具gcc gcc-c++make automake autoconf kernel-devel<br />
2、安装PHP所需依赖，如libxml2-devel openssl-devel curl-devel libjpeg-devel libpng-devel等</p>
<ol title="Double click to hide line number.">yum -y install gcc gcc-c++  make automake autoconf kernel-devel ncurses-devel libxml2-devel openssl-devel curl-devel libjpeg-devel libpng-devel  pcre-devel libtool-libs freetype-devel gd zlib-devel file bison patch mlocate flex diffutils   readline-devel glibc-devel glib2-devel bzip2-devel gettext-devel libcap-devel libmcrypt-devel</ol>
<h3 id="下载所需源码">下载所需源码</h3>
<p><a title="apache" href="http://www.centos.bz/category/web-server/apache/">apache</a>:http://httpd.apache.org/<br />
<a title="mysql" href="http://www.centos.bz/category/mysql/">mysql</a>:http://mysql.com/downloads/mysql/<br />
php:http://php.net/downloads.php<br />
<a title="phpmyadmin" href="http://www.centos.bz/tag/phpmyadmin/">phpmyadmin</a>:http://www.phpmyadmin.net/home_page/downloads.php<br />
我们这里选择的版本为：apache-2.2.22,mysql-5.1.62,php-5.2.17,phpmyadmin-3.4.10.2</p>
<ol title="Double click to hide line number.">cd /tmp</p>
<li>wget -c http://apache.ziply.com//httpd/httpd-2.2.22.tar.gz</li>
<li>wget -c http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.64.tar.gz/from/http://mysql.he.net/</li>
<li>wget -c http://us2.php.net/get/php-5.2.17.tar.gz/from/am.php.net/mirror</li>
<li>wget -c http://iweb.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/3.4.10.2/phpMyAdmin-3.4.10.2-all-languages.tar.gz</li>
<li>tar xzf httpd-2.2.22.tar.gz</li>
<li>tar xzf mysql-5.1.62.tar.gz</li>
<li>tar xzf php-5.2.17.tar.gz</li>
<li>tar xzf phpMyAdmin-3.4.10.2-all-languages.tar.gz</li>
</ol>
<h3 id="安装apache2.2.22">安装apache2.2.22</h3>
<ol title="Double click to hide line number.">cd /tmp/httpd-2.2.22</p>
<li>./configure &#8211;prefix=/usr/local/apache &#8211;with-included-apr &#8211;enable-so &#8211;enable-deflate=shared &#8211;enable-expires=shared  &#8211;enable-headers=shared &#8211;enable-rewrite=shared &#8211;enable-static-support</li>
<li>make</li>
<li>make install</li>
</ol>
<p>编译参数解释：<br />
–prefix=/usr/local/apache：指定安装目录<br />
–with-included-apr：在编译时强制使用当前源代码中绑定的APR版本<br />
–enable-so：允许运行时加载DSO模块<br />
–enable-deflate=shared:将deflate模块编译为DSO<br />
–enable-expires=shared:将expires模块编译为DSO<br />
–enable-headers=shared:将headers模块编译为DSO<br />
–enable-rewrite=shared:将rewrite模块编译为DSO<br />
–enable-static-support:使用静态连接(默认为动态连接)编译所有二进制支持程序<br />
更详细的编译参数解释：<a href="http://lamp.linux.gov.cn/Apache/ApacheMenu/programs/configure.html" target="_blank">http://lamp.linux.gov.cn/Apache/ApacheMenu/programs/configure.html</a></p>
<ol title="Double click to hide line number.">cp build/rpm/httpd.init /etc/init.d/httpd //使用init脚本管理httpd</p>
<li>chmod 755 /etc/init.d/httpd //增加执行权限</li>
<li>chkconfig &#8211;add httpd  //添加httpd到服务项</li>
<li>chkconfig  httpd on   //设置开机启动</li>
<li>ln -fs /usr/local/apache/ /etc/httpd</li>
<li>ln -fs /usr/local/apache/bin/httpd /usr/sbin/httpd</li>
<li>ln -fs /usr/local/apache/bin/apachectl /usr/sbin/apachectl</li>
<li>ln -fs /usr/local/apache/logs /var/log/httpd //设置软链接以适应init脚本</li>
</ol>
<h3 id="安装mysql5.1.62">安装mysql5.1.62</h3>
<ol title="Double click to hide line number.">groupadd mysql</p>
<li>useradd -g mysql mysql</li>
<li>cd /tmp/mysql-5.1.62</li>
<li>./configure &#8211;prefix=/usr/local/mysql/ &#8211;localstatedir=/usr/local/mysql/data &#8211;without-debug &#8211;with-unix-socket-path=/tmp/mysql.sock &#8211;with-client-ldflags=-all-static &#8211;with-mysqld-ldflags=-all-static &#8211;enable-assembler &#8211;with-extra-charsets=gbk,gb2312,utf8 &#8211;with-pthread</li>
<li>make</li>
<li>make install</li>
</ol>
<p>编译参数解释：<br />
–prefix=/usr/local/mysql/:指定安装位置<br />
–localstatedir=/usr/local/mysql/data：指定数据库文件位置<br />
–without-debug：禁用调用模式<br />
–with-unix-socket-path=/tmp/mysql.sock:指定sock文件位置<br />
–with-client-ldflags=-all-static：<br />
–with-mysqld-ldflags=-all-static:以纯静态方式编译服务端和客户端<br />
–enable-assembler：使用一些字符函数的汇编版本<br />
–with-extra-charsets=gbk,gb2312,utf8 ：gbk,gb2312,utf8字符支持<br />
–with-pthread:强制使用pthread库(posix线程库)<br />
更多编译参数请执行./configure –help命令查看。</p>
<ol title="Double click to hide line number.">cp support-files/my-medium.cnf /etc/my.cnf //复制配置文件夹my.cnf</p>
<li>/usr/local/mysql/bin/mysql_install_db &#8211;user=mysql  //初始化数据库</li>
<li>chown -R root.mysql /usr/local/mysql</li>
<li>chown -R mysql /usr/local/mysql/data </li>
<li>cp /tmp/mysql-5.1.62/support-files/mysql.server /etc/rc.d/init.d/mysqld  //init启动脚本</li>
<li>chown root.root /etc/rc.d/init.d/mysqld </li>
<li>chmod 755 /etc/rc.d/init.d/mysqld</li>
<li>chkconfig &#8211;add mysqld</li>
<li>chkconfig  mysqld on</li>
<li>ln -s /usr/local/mysql/bin/mysql /usr/bin</li>
<li>ln -s /usr/local/mysql/bin/mysqladmin /usr/bin</li>
<li>service mysqld start</li>
<li>/usr/local/mysql/bin/mysqladmin -u root password &#8216;新密码&#8217;   //设置root密码</li>
</ol>
<h3 id="安装PHP5.2.17">安装PHP5.2.17</h3>
<p>在编译php之前，先要解决两个问题：<a title="centos" href="http://www.centos.bz/">centos</a> 6上libmcrypt的安装和可能有些系统找不到libiconv导致的错误。<br />
1、centos 6官方源已经没有libmcrypt的rpm包，我们这里选择编译安装，当然你也可以导入第三方源安装(centos 5略过此步)。<br />
下载源码：</p>
<ol title="Double click to hide line number.">cd /tmp</p>
<li>wget http://superb-dca2.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz</li>
<li>wget http://superb-dca2.dl.sourceforge.net/project/mhash/mhash/0.9.9.9/mhash-0.9.9.9.tar.gz</li>
<li>wget http://superb-sea2.dl.sourceforge.net/project/mcrypt/MCrypt/2.6.8/mcrypt-2.6.8.tar.gz</li>
<li>tar xzf libmcrypt-2.5.8.tar.gz</li>
<li>tar xzf mhash-0.9.9.9.tar.gz</li>
<li>tar xzf mcrypt-2.6.8.tar.gz</li>
<li>//安装libmcrypt</li>
<li>cd /tmp/libmcrypt-2.5.8</li>
<li>./configure &#8211;prefix=/usr</li>
<li>make &amp;&amp; make install</li>
<li>//安装libmcrypt</li>
<li>cd /tmp/mhash-0.9.9.9</li>
<li>./configure &#8211;prefix=/usr</li>
<li>make &amp;&amp; make install</li>
<li>//安装mcrypt</li>
<li>/sbin/ldconfig //搜索出可共享的动态链接库</li>
<li>cd /tmp/mcrypt-2.6.8</li>
<li>./configure</li>
<li>make &amp;&amp; make install</li>
</ol>
<p>2、解决可能出现的libiconv错误。</p>
<ol title="Double click to hide line number.">cd /tmp</p>
<li>wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz</li>
<li>tar xzf libiconv-1.14.tar.gz</li>
<li>cd libiconv-1.14</li>
<li>./configure &#8211;prefix=/usr/local/libiconv</li>
<li>make &amp;&amp; make install</li>
</ol>
<p>开始安装php-5.2.17:</p>
<ol title="Double click to hide line number.">cd /tmp/php-5.2.17</p>
<li>./configure &#8211;prefix=/usr/local/php &#8211;with-apxs2=/usr/local/apache/bin/apxs &#8211;with-config-file-path=/etc &#8211;with-config-file-scan-dir=/etc/php.d &#8211;with-openssl &#8211;with-zlib &#8211;enable-bcmath &#8211;with-bz2 &#8211;with-curl &#8211;enable-ftp &#8211;with-gd &#8211;enable-gd-native-ttf &#8211;with-gettext &#8211;with-mhash &#8211;enable-mbstring &#8211;with-mcrypt &#8211;enable-soap &#8211;enable-zip &#8211;with-iconv=/usr/local/libiconv &#8211;with-mysql=/usr/local/mysql &#8211;without-pear</li>
<li>make</li>
<li>make install</li>
</ol>
<p>编译参数解释：<br />
–prefix=/usr/local/php:设置安装路径<br />
–with-apxs2=/usr/local/apache/bin/apxs:编译共享的 Apache 2.0 模块<br />
–with-config-file-path=/etc:指定配置文件php.ini地址<br />
–with-config-file-scan-dir=/etc/php.d:指定额外的ini文件目录<br />
–with-openssl:编译OpenSSL支持<br />
–with-zlib:编译zlib支持<br />
–enable-bcmath:启用BC风格精度数学函数<br />
–with-bz2:BZip2支持<br />
–with-curl:CRUL支持<br />
–enable-ftp:FTP支持<br />
–with-gd:GD支持<br />
–enable-gd-native-ttf:启用TrueType字符串函数<br />
–with-gettext:启用GNU gettext支持<br />
–with-mhash:mhash支持<br />
–enable-mbstring:启用支持多字节字符串<br />
–with-mcrypt:编译mcrypt加密支持<br />
–enable-soap:SOAP支持<br />
–enable-zip:启用zip 读/写支持<br />
–with-iconv=/usr/local/libiconv:iconv支持<br />
–with-mysql=/usr/local/mysql:启用mysql支持<br />
–without-pear:不安装PEAR<br />
更多编译参数解释参考<a href="http://www.php.net/manual/zh/configure.about.php" target="_blank">http://www.php.net/manual/zh/configure.about.php</a>或者./configure –help查看。</p>
<ol title="Double click to hide line number.">cp php.ini-dist /usr/local/php/etc/php.ini //复制配置文件php.ini</ol>
<p>在/etc/httpd/conf/httpd.conf文件中加入php文件类型解析：</p>
<ol title="Double click to hide line number.">Addtype application/x-httpd-php .php</ol>
<p>重启httpd:</p>
<ol title="Double click to hide line number.">service httpd restart</ol>
<h3 id="安装ZendOptimizer-3.3.9(可选)">安装ZendOptimizer-3.3.9(可选)</h3>
<p>ZendOptimizer的作用是分析,优化由Zend 编译器加密产生的代码的程序，对不是Zend编译器加密过的程序，没有必要安装这个。<br />
64位：http://downloads.zend.com/optimizer/3.3.9/ZendOptimizer-3.3.9-<a title="linux" href="http://www.centos.bz/tag/linux/">linux</a>-glibc23-x86_64.tar.gz<br />
32位：http://downloads.zend.com/optimizer/3.3.9/ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz</p>
<ol title="Double click to hide line number.">cd /tmp</p>
<li>wget http://downloads.zend.com/optimizer/3.3.9/ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz</li>
<li>tar xzf ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz</li>
<li>cd /tmp/ZendOptimizer-3.3.9-linux-glibc23-i386/data/5_2_x_comp/</li>
<li>mkdir -p /usr/local/Zend/lib/</li>
<li>cp ZendOptimizer.so /usr/local/Zend/lib</li>
</ol>
<p>加载zendoptimizer，建立/etc/php.d/zend.ini文件，加入如下代码加载：</p>
<ol title="Double click to hide line number.">[zend]</p>
<li>zend_optimizer.optimization_level=15</li>
<li>zend_extension=/usr/local/Zend/lib/ZendOptimizer.so</li>
</ol>
<p>重启httpd生效：</p>
<ol title="Double click to hide line number.">service httpd restart</ol>
<h3 id="安装eAccelerator-0.9.6.1(可选)">安装eAccelerator-0.9.6.1(可选)</h3>
<p>eAccelerator是一个自由开放源码php加速器，优化和动态内容缓存，提高了php脚本的缓存性能，使得PHP脚本在编译的状态下，对服务器的开销几乎完全消除。 它还有对脚本起优化作用，以加快其执行效率。使您的PHP程序代码执效率能提高1-10倍。类似的php加速器有：Xcache,APC等。下面是安装方法：</p>
<ol title="Double click to hide line number.">cd /tmp</p>
<li>wget http://voxel.dl.sourceforge.net/project/eaccelerator/eaccelerator/eAccelerator%200.9.6.1/eaccelerator-0.9.6.1.zip</li>
<li>unzip eaccelerator-0.9.6.1.zip</li>
<li>cd eaccelerator-0.9.6.1</li>
<li>export PHP_PREFIX=&#8221;/usr/local/php&#8221;</li>
<li>$PHP_PREFIX/bin/phpize</li>
<li>./configure -enable-eaccelerator=shared -with-php-config=$PHP_PREFIX/bin/php-config</li>
<li>make &amp;&amp; make install</li>
<li>cd /tmp</li>
<li>mkdir eaccelerator</li>
<li>chmod 0777 eaccelerator</li>
</ol>
<p>加载eAccelerator,创建/ec/php.d/ea.ini文件，加入如下代码加载：</p>
<ol title="Double click to hide line number.">[eaccelerator]</p>
<li>zend_extension=&#8221;/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so&#8221;</li>
<li>eaccelerator.shm_size=&#8221;32&#8243;</li>
<li>eaccelerator.cache_dir=&#8221;/tmp/eaccelerator&#8221;</li>
<li>eaccelerator.enable=&#8221;1&#8243;</li>
<li>eaccelerator.optimizer=&#8221;1&#8243;</li>
<li>eaccelerator.check_mtime=&#8221;1&#8243;</li>
<li>eaccelerator.debug=&#8221;0&#8243;</li>
<li>eaccelerator.filter=&#8221;"</li>
<li>eaccelerator.shm_max=&#8221;0&#8243;</li>
<li>eaccelerator.shm_ttl=&#8221;0&#8243;</li>
<li>eaccelerator.shm_prune_period=&#8221;0&#8243;</li>
<li>eaccelerator.shm_only=&#8221;0&#8243;</li>
<li>eaccelerator.compress=&#8221;1&#8243;</li>
<li>eaccelerator.compress_level=&#8221;9&#8243;</li>
</ol>
<p>eaccelerator参数设置参考：<a href="http://www.centos.bz/2012/03/eaccelerator-parameter/">http://www.centos.bz/2012/03/eaccelerator-parameter/</a><br />
重启httpd生效：</p>
<ol title="Double click to hide line number.">service httpd restart</ol>
<p>转载请注明《文章来源：<a rel="bookmark" href="http://www.centos.bz/2011/09/centos-compile-lamp-apache-mysql-php/">http://www.centos.bz/2011/09/centos-compile-lamp-apache-mysql-php/</a>》</p>
]]></content:encoded>
			<wfw:commentRss>http://anywang.vicp.net:8180/wp/?feed=rss2&#038;p=236</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>为Apache配置mod_deflat压缩输出[转载]</title>
		<link>http://anywang.vicp.net:8180/wp/?p=185</link>
		<comments>http://anywang.vicp.net:8180/wp/?p=185#comments</comments>
		<pubDate>Wed, 16 Nov 2011 06:51:33 +0000</pubDate>
		<dc:creator>网邻</dc:creator>
				<category><![CDATA[Apache]]></category>

		<guid isPermaLink="false">http://anywang.vicp.net/wp/?p=185</guid>
		<description><![CDATA[[文章作者：张宴 本文版本：v1.0 最后修改：2007.09.10 转载请注明出处：http://blog.s135.com] 　　1、如果未安装Apache。编译时，加上&#8211;enable-deflate，例如：（仅针对Linux版，Windows版无须此步骤） 　　./configure &#8211;prefix=/usr/local/apache &#8211;enable-rewrite &#8211;enable-so &#8211;enable-deflate 　　2、如果已安装Apache。添加mod_deflate模块，例如：（仅针对Linux版，Windows版无须此步骤） 　　/usr/local/apache/bin/apxs -i -a -c /home/zhangyan/software/httpd-2.0.59/modules/filters/mod_deflate.c 　　注：/home/zhangyan/software/httpd-2.0.59/为Apache源码路径。 　　3、进行以上步骤后，会在httpd.conf中自动加入一行：（Windows版请将下行最前面的#号去掉） 引用 LoadModule deflate_module     modules/mod_deflate.so 　　4、编辑httpd.conf，增加： 　　Linux版： 引用 &#60;ifmodule mod_deflate.c&#62; DeflateCompressionLevel 9 SetOutputFilter DEFLATE #DeflateFilterNote Input instream #DeflateFilterNote Output outstream #DeflateFilterNote Ratio ratio #LogFormat &#8216;&#8221;%r&#8221; %{outstream}n/%{instream}n (%{ratio}n%%)&#8217; deflate #CustomLog logs/deflate_log.log deflate &#60;/ifmodule&#62; 　　Windows版： 引用 &#60;ifmodule deflate_module&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>[文章作者：张宴 本文版本：v1.0 最后修改：2007.09.10 转载请注明出处：<a href="http://blog.s135.com/" target="_blank"><span style="color: #4f6371;">http://blog.s135.com</span></a>]</p>
<p>　　1、如果未安装Apache。编译时，加上&#8211;enable-deflate，例如：（仅针对Linux版，Windows版无须此步骤）<br />
　　./configure &#8211;prefix=/usr/local/apache &#8211;enable-rewrite &#8211;enable-so &#8211;enable-deflate</p>
<p>　　2、如果已安装Apache。添加mod_deflate模块，例如：（仅针对Linux版，Windows版无须此步骤）<br />
　　/usr/local/apache/bin/apxs -i -a -c /home/zhangyan/software/httpd-2.0.59/modules/filters/mod_deflate.c<br />
　　注：/home/zhangyan/software/httpd-2.0.59/为Apache源码路径。</p>
<p>　　3、进行以上步骤后，会在httpd.conf中自动加入一行：（Windows版请将下行最前面的#号去掉）</p>
<div>引用</div>
<p>LoadModule deflate_module     modules/mod_deflate.so<br />
　　4、编辑httpd.conf，增加：<br />
　　Linux版：</p>
<div>引用</div>
<p>&lt;ifmodule mod_deflate.c&gt;<br />
DeflateCompressionLevel 9<br />
SetOutputFilter DEFLATE<br />
#DeflateFilterNote Input instream<br />
#DeflateFilterNote Output outstream<br />
#DeflateFilterNote Ratio ratio<br />
#LogFormat &#8216;&#8221;%r&#8221; %{outstream}n/%{instream}n (%{ratio}n%%)&#8217; deflate<br />
#CustomLog logs/deflate_log.log deflate<br />
&lt;/ifmodule&gt;<br />
　　Windows版：</p>
<div>引用</div>
<p>&lt;ifmodule deflate_module&gt;<br />
DeflateCompressionLevel 9<br />
SetOutputFilter DEFLATE<br />
#DeflateFilterNote Input instream<br />
#DeflateFilterNote Output outstream<br />
#DeflateFilterNote Ratio ratio<br />
#LogFormat &#8216;&#8221;%r&#8221; %{outstream}n/%{instream}n (%{ratio}n%%)&#8217; deflate<br />
#CustomLog logs/deflate_log.log deflate<br />
&lt;/ifmodule&gt;<br />
　　如果将#号去掉，可以在logs/deflate_log.log日志文件中看到文件压缩前后的字节数、压缩比，例如：<br />
　　&#8221;GET /index.html HTTP/1.1&#8243; 49373/276249 (17%)<br />
　　压缩前的字节数为276249，压缩后的字节数为49373，压缩比为17%</p>
<p>　　5、详细配置见Apache官方网站：<a href="http://httpd.apache.org/docs/2.0/mod/mod_deflate.html" target="_blank"><span style="color: #4f6371;">http://httpd.apache.org/docs/2.0/mod/mod_deflate.html</span></a></p>
]]></content:encoded>
			<wfw:commentRss>http://anywang.vicp.net:8180/wp/?feed=rss2&#038;p=185</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>eAccelerator 配置参数详解</title>
		<link>http://anywang.vicp.net:8180/wp/?p=175</link>
		<comments>http://anywang.vicp.net:8180/wp/?p=175#comments</comments>
		<pubDate>Fri, 11 Nov 2011 13:37:18 +0000</pubDate>
		<dc:creator>网邻</dc:creator>
				<category><![CDATA[Apache]]></category>

		<guid isPermaLink="false">http://anywang.vicp.net/wp/?p=175</guid>
		<description><![CDATA[eaccelerator.shm_size=&#8221;32&#8243; eAccelerator 可以使用的共享内存的数量 (以兆为单位) . &#8220;0&#8243; 是指操作系统的默认值. 默认值是 &#8220;0&#8243;.可根据服务器的实际情况来调整，16，32，64，128都是可以的。 eaccelerator.cache_dir=&#8221;/home/php/tmp&#8221; 这个目录是给磁盘缓存使用. eAccelerator 在这里储存预先编译好的代码, 进程数据, 内容以及用户的自定义内容. 同样的数据也能被储存在共享内存中 (这样可以提高访问速度). 默认的设置是 &#8220;/tmp/eaccelerator&#8221;. eaccelerator.enable=&#8221;1&#8243; 开启或关闭 eAccelerator。&#8221;1&#8243; 为开启，&#8221;0&#8243; 为关闭。默认值为 &#8220;1&#8243;。 eaccelerator.optimizer=&#8221;1&#8243; 启或关闭内部优化器，可以提升代码执行速度。&#8221;1&#8243; 为开启，&#8221;0&#8243; 为关闭。默认值为 &#8220;1&#8243;。 eaccelerator.check_mtime=&#8221;1&#8243; 打开或者关闭 PHP 的文件修改检查. &#8220;1&#8243; 是指打开, &#8220;0&#8243; 是指关闭. 如果您在修改以后重新编译 PHP 的文件,那么您应当设置为 &#8220;1&#8243;. 默认值是 &#8220;1&#8243;. eaccelerator.debug=&#8221;0&#8243; 开启或关闭调试日志记录。&#8221;1&#8243; 为开启，&#8221;0&#8243; 为关闭。默认值为 &#8220;0&#8243;。会将缓存命中得记录写入日志。 eaccelerator.filter=&#8221;" 判断哪些 PHP 文件必须缓存。您可以指定缓存和不缓存的文件类型（如 &#8220;*.php *.phtml&#8221;等） [...]]]></description>
			<content:encoded><![CDATA[<p><strong>eaccelerator.shm_size=&#8221;32&#8243;</strong><br />
eAccelerator 可以使用的共享内存的数量 (以兆为单位) . &#8220;0&#8243; 是指操作系统的默认值. 默认值是 &#8220;0&#8243;.可根据服务器的实际情况来调整，16，32，64，128都是可以的。</p>
<p><strong>eaccelerator.cache_dir=&#8221;/home/php/tmp&#8221;</strong><br />
这个目录是给磁盘缓存使用. eAccelerator 在这里储存预先编译好的代码, 进程数据, 内容以及用户的自定义内容. 同样的数据也能被储存在共享内存中 (这样可以提高访问速度). 默认的设置是 &#8220;/tmp/eaccelerator&#8221;.</p>
<p><strong>eaccelerator.enable=&#8221;1&#8243;</strong><br />
开启或关闭 eAccelerator。&#8221;1&#8243; 为开启，&#8221;0&#8243; 为关闭。默认值为 &#8220;1&#8243;。</p>
<p><strong>eaccelerator.optimizer=&#8221;1&#8243;</strong><br />
启或关闭内部优化器，可以提升代码执行速度。&#8221;1&#8243; 为开启，&#8221;0&#8243; 为关闭。默认值为 &#8220;1&#8243;。</p>
<p><strong>eaccelerator.check_mtime=&#8221;1&#8243;</strong><br />
打开或者关闭 PHP 的文件修改检查. &#8220;1&#8243; 是指打开, &#8220;0&#8243; 是指关闭. 如果您在修改以后重新编译 PHP 的文件,那么您应当设置为 &#8220;1&#8243;. 默认值是 &#8220;1&#8243;.</p>
<p><strong>eaccelerator.debug=&#8221;0&#8243;</strong><br />
开启或关闭调试日志记录。&#8221;1&#8243; 为开启，&#8221;0&#8243; 为关闭。默认值为 &#8220;0&#8243;。会将缓存命中得记录写入日志。</p>
<p><strong>eaccelerator.filter=&#8221;"</strong><br />
判断哪些 PHP 文件必须缓存。您可以指定缓存和不缓存的文件类型（如 &#8220;*.php *.phtml&#8221;等）<br />
如果参数以 &#8220;!&#8221; 开头，则匹配这些参数的文件被忽略缓存。默认值为 &#8220;&#8221;，即，所有 PHP 文件都将被缓存。</p>
<p><strong>eaccelerator.shm_max=&#8221;0&#8243;</strong><br />
当使用 &#8221; eaccelerator_put() &#8221; 函数时禁止其向共享内存中存储过大的文件。该参数指定允许存储的最大值，单位：字节 (10240, 10K, 1M)。&#8221;0&#8243; 为不限制。默认值为 &#8220;0&#8243;。</p>
<p><strong>eaccelerator.shm_ttl=&#8221;0&#8243;</strong><br />
当 eAccelerator 获取新脚本的共享内存大小失败时，它将从共享内存中删除所有在最后 &#8220;shm_ttl&#8221; 秒内没有存取的脚本缓存。默认值为 &#8220;0&#8243;，即：不从共享内春中删除任何缓存文件。</p>
<p><strong>eaccelerator.shm_prune_period=&#8221;0&#8243;</strong><br />
当 eAccelerator 获取新脚本的共享内存大小失败时，他将试图从共享内存中删除早于&#8221;shm_prune_period&#8221; 秒的缓存脚本。默认值为 &#8220;0&#8243;，即：不从共享内春中删除任何缓存文件。</p>
<p><strong>eaccelerator.shm_only=&#8221;0&#8243;</strong><br />
允许或禁止将已编译脚本缓存在磁盘上。该选项对 session 数据和内容缓存无效。默认值为 &#8220;0&#8243;，即：使用磁盘和共享内存进行缓存。</p>
<p><strong>eaccelerator.compress=&#8221;1&#8243;</strong><br />
允许或禁止压缩内容缓存。默认值为 &#8220;1&#8243;，即：允许压缩。</p>
<p><strong>eaccelerator.compress_level=&#8221;9&#8243;</strong><br />
指定内容缓存的压缩等级。默认值为 &#8220;9&#8243;，为最高等级。</p>
<p><strong>eaccelerator.keys = &#8220;disk_only&#8221;</strong><br />
<strong>eaccelerator.session = &#8220;disk_only&#8221;</strong><br />
<strong>eaccelerator.content = &#8220;disk_only&#8221;</strong><br />
设置内容缓存的存放的地方，可以设置为：<br />
<strong>shm_and_disk</strong> 在共享缓存和硬盘(默认值)<br />
<strong>shm </strong>默认存在共享内存，如果共享内存已满或大小超过 &#8220;eaccelerator.shm_max&#8221; 的值，就存到硬盘<br />
<strong>shm_only </strong>只存放在共享内存<br />
<strong>disk_only </strong>只存放在硬盘<br />
<strong>none </strong>不缓存数据</p>
<p><strong>eaccelerator.allowed_admin_path = &#8220;/var/www/html/21andy.com/eaccelerator&#8221;</strong><br />
这是控制面板的地址<br />
安装包里有个control.php，你把它复制到网站的任意目录，可以用它查看和管理，这个必须指定，否则查看缓存内容的时候会出错</p>
<p>最后，来看一下我的 eAccelerator 设置</p>
<p>; eaccelerator<br />
[eaccelerator]<br />
zend_extension=&#8221;/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so&#8221;<br />
eaccelerator.shm_size=&#8221;128&#8243;<br />
eaccelerator.cache_dir=&#8221;/tmp/eaccelerator&#8221;<br />
eaccelerator.enable=&#8221;1&#8243;<br />
eaccelerator.optimizer=&#8221;1&#8243;<br />
eaccelerator.check_mtime=&#8221;1&#8243;<br />
eaccelerator.debug=&#8221;0&#8243;<br />
eaccelerator.filter=&#8221;"<br />
eaccelerator.shm_max=&#8221;0&#8243;<br />
eaccelerator.shm_ttl=&#8221;3600&#8243;<br />
eaccelerator.shm_prune_period=&#8221;3600&#8243;<br />
eaccelerator.shm_only=&#8221;0&#8243;<br />
eaccelerator.compress=&#8221;1&#8243;<br />
eaccelerator.compress_level=&#8221;9&#8243;<br />
eaccelerator.keys = &#8220;disk_only&#8221;<br />
eaccelerator.sessions = &#8220;disk_only&#8221;<br />
eaccelerator.content = &#8220;disk_only&#8221;<br />
eaccelerator.allowed_admin_path = &#8220;/var/www/html/21andy.com/eaccelerator&#8221;</p>
<p>另外，再说下 eAccelerator 的安装</p>
<p># wget http://bart.eaccelerator.net/source/0.9.6/eaccelerator-0.9.6.tar.bz2<br />
# tar -jxvf eaccelerator-0.9.6.tar.bz2<br />
# cd eaccelerator-0.9.6<br />
# /usr/local/php/bin/phpize<br />
# ./configure &#8211;enable-eaccelerator=shared &#8211;with-php-config=/usr/local/php/bin/php-config<br />
# make &amp;&amp; make install<span id="_marker"> </span></p>
<p><span style="color: #00ccff;"><strong>eaccelerator.shm_size=&#8221;32&#8243;</strong><br />
</span>eAccelerator 可以使用的共享内存的数量 (以兆为单位) . &#8220;0&#8243; 是指操作系统的默认值. 默认值是 &#8220;0&#8243;.可根据服务器的实际情况来调整，16，32，64，128都是可以的。</p>
<p><span style="color: #00ccff;"><strong>eaccelerator.cache_dir=&#8221;/home/php/tmp&#8221;</strong><br />
</span>这个目录是给磁盘缓存使用. eAccelerator 在这里储存预先编译好的代码, 进程数据, 内容以及用户的自定义内容. 同样的数据也能被储存在共享内存中 (这样可以提高访问速度). 默认的设置是 &#8220;/tmp/eaccelerator&#8221;.</p>
<p><span style="color: #00ccff;"><strong>eaccelerator.enable=&#8221;1&#8243;</strong><br />
</span>开启或关闭 eAccelerator。&#8221;1&#8243; 为开启，&#8221;0&#8243; 为关闭。默认值为 &#8220;1&#8243;。</p>
<p><span style="color: #00ccff;"><strong>eaccelerator.optimizer=&#8221;1&#8243;</strong><br />
</span>启或关闭内部优化器，可以提升代码执行速度。&#8221;1&#8243; 为开启，&#8221;0&#8243; 为关闭。默认值为 &#8220;1&#8243;。</p>
<p><span style="color: #00ccff;"><strong>eaccelerator.check_mtime=&#8221;1&#8243;</strong><br />
</span>打开或者关闭 PHP 的文件修改检查. &#8220;1&#8243; 是指打开, &#8220;0&#8243; 是指关闭. 如果您在修改以后重新编译 PHP 的文件,那么您应当设置为 &#8220;1&#8243;. 默认值是 &#8220;1&#8243;.</p>
<p><span style="color: #00ccff;"><strong>eaccelerator.debug=&#8221;0&#8243;</strong><br />
</span>开启或关闭调试日志记录。&#8221;1&#8243; 为开启，&#8221;0&#8243; 为关闭。默认值为 &#8220;0&#8243;。会将缓存命中得记录写入日志。</p>
<p><span style="color: #00ccff;"><strong>eaccelerator.filter=&#8221;"</strong><br />
</span>判断哪些 PHP 文件必须缓存。您可以指定缓存和不缓存的文件类型（如 &#8220;*.php *.phtml&#8221;等）<br />
如果参数以 &#8220;!&#8221; 开头，则匹配这些参数的文件被忽略缓存。默认值为 &#8220;&#8221;，即，所有 PHP 文件都将被缓存。</p>
<p><span style="color: #00ccff;"><strong>eaccelerator.shm_max=&#8221;0&#8243;</strong><br />
</span>当使用 &#8221; eaccelerator_put() &#8221; 函数时禁止其向共享内存中存储过大的文件。该参数指定允许存储的最大值，单位：字节 (10240, 10K, 1M)。&#8221;0&#8243; 为不限制。默认值为 &#8220;0&#8243;。</p>
<p><span style="color: #00ccff;"><strong>eaccelerator.shm_ttl=&#8221;0&#8243;</strong><br />
</span>当 eAccelerator 获取新脚本的共享内存大小失败时，它将从共享内存中删除所有在最后 &#8220;shm_ttl&#8221; 秒内没有存取的脚本缓存。默认值为 &#8220;0&#8243;，即：不从共享内春中删除任何缓存文件。</p>
<p><span style="color: #00ccff;"><strong>eaccelerator.shm_prune_period=&#8221;0&#8243;</strong><br />
</span>当 eAccelerator 获取新脚本的共享内存大小失败时，他将试图从共享内存中删除早于&#8221;shm_prune_period&#8221; 秒的缓存脚本。默认值为 &#8220;0&#8243;，即：不从共享内春中删除任何缓存文件。</p>
<p><span style="color: #00ccff;"><strong>eaccelerator.shm_only=&#8221;0&#8243;</strong><br />
</span>允许或禁止将已编译脚本缓存在磁盘上。该选项对 session 数据和内容缓存无效。默认值为 &#8220;0&#8243;，即：使用磁盘和共享内存进行缓存。</p>
<p><span style="color: #00ccff;"><strong>eaccelerator.compress=&#8221;1&#8243;</strong><br />
</span>允许或禁止压缩内容缓存。默认值为 &#8220;1&#8243;，即：允许压缩。</p>
<p><span style="color: #00ccff;"><strong>eaccelerator.compress_level=&#8221;9&#8243;</strong><br />
</span>指定内容缓存的压缩等级。默认值为 &#8220;9&#8243;，为最高等级。</p>
<p><span style="color: #00ccff;"><strong>eaccelerator.keys = &#8220;disk_only&#8221;</strong><br />
<strong>eaccelerator.session = &#8220;disk_only&#8221;</strong><br />
<strong>eaccelerator.content = &#8220;disk_only&#8221;</strong><br />
</span>设置内容缓存的存放的地方，可以设置为：<br />
<strong><span style="color: #00ccff;">shm_and_disk</span></strong> 在共享缓存和硬盘(默认值)<br />
<strong><span style="color: #00ccff;">shm </span></strong>默认存在共享内存，如果共享内存已满或大小超过 &#8220;eaccelerator.shm_max&#8221; 的值，就存到硬盘<br />
<strong><span style="color: #00ccff;">shm_only </span></strong>只存放在共享内存<br />
<strong><span style="color: #00ccff;">disk_only </span></strong>只存放在硬盘<br />
<strong><span style="color: #00ccff;">none </span></strong>不缓存数据</p>
<p><span style="color: #00ccff;"><strong>eaccelerator.allowed_admin_path = &#8220;/var/www/html/21andy.com/eaccelerator&#8221;</strong><br />
</span>这是控制面板的地址<br />
安装包里有个control.php，你把它复制到网站的任意目录，可以用它查看和管理，这个必须指定，否则查看缓存内容的时候会出错</p>
<p>最后，来看一下我的 eAccelerator 设置</p>
<div class="hl-surround">
<div class="hl-main">; eaccelerator<br />
[eaccelerator]<br />
zend_extension=&#8221;/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so&#8221;<br />
eaccelerator.shm_size=&#8221;128&#8243;<br />
eaccelerator.cache_dir=&#8221;/tmp/eaccelerator&#8221;<br />
eaccelerator.enable=&#8221;1&#8243;<br />
eaccelerator.optimizer=&#8221;1&#8243;<br />
eaccelerator.check_mtime=&#8221;1&#8243;<br />
eaccelerator.debug=&#8221;0&#8243;<br />
eaccelerator.filter=&#8221;"<br />
eaccelerator.shm_max=&#8221;0&#8243;<br />
eaccelerator.shm_ttl=&#8221;3600&#8243;<br />
eaccelerator.shm_prune_period=&#8221;3600&#8243;<br />
eaccelerator.shm_only=&#8221;0&#8243;<br />
eaccelerator.compress=&#8221;1&#8243;<br />
eaccelerator.compress_level=&#8221;9&#8243;<br />
eaccelerator.keys = &#8220;disk_only&#8221;<br />
eaccelerator.sessions = &#8220;disk_only&#8221;<br />
eaccelerator.content = &#8220;disk_only&#8221;<br />
eaccelerator.allowed_admin_path = &#8220;/var/www/html/21andy.com/eaccelerator&#8221;</div>
</div>
<p>另外，再说下 eAccelerator 的安装</p>
<div class="hl-surround">
<div class="hl-main"># wget http://bart.eaccelerator.net/source/0.9.6/eaccelerator-0.9.6.tar.bz2<br />
# tar -jxvf eaccelerator-0.9.6.tar.bz2<br />
# cd eaccelerator-0.9.6<br />
# /usr/local/php/bin/phpize<br />
# ./configure &#8211;enable-eaccelerator=shared &#8211;with-php-config=/usr/local/php/bin/php-config<br />
# make &amp;&amp; make install</div>
</div>
<p> </p>
<p>文章来源：<a href="http://www.21andy.com/blog/20100207/1646.html">http://www.21andy.com/blog/20100207/1646.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://anywang.vicp.net:8180/wp/?feed=rss2&#038;p=175</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
