谷歌开源项目经理克里斯·迪邦纳(Chris DiBonap)在博客中称,“我们在网络上传输或在磁盘上存储的几乎所有结构化信息都使用了这种语言。我们认为,Protocol Buffers对其他人也有大有裨益,因此决定把它作为开源软件发布。”
谷歌软件工程师肯顿·瓦尔达(Kenton Varda)在公司开源博客网站上表示,谷歌使用数千种不同的数据格式,其中大多数为结构化数据格式。利用XML来处理这些海量结构化数据显得力不从心,于是谷歌开发了Protocol Buffers。
瓦尔达将Protocol Buffers比作一种接口描述语言(IDL),但没有IDL的复杂性。瓦尔达说:“Protocol Buffers的主要设计目标之一是简洁,而实际情况也是如此。Protocol Buffers不但功能强大,在速度上也至少比XML要快出一个数量级。”
据谷歌文档称,与具有可比性的XML文件相比,Protocol Buffers文件体积小2-9倍,解析速度快19-99倍。
谷歌还称,将来还计划把更多其他软件项目作为开源软件发布。因为这些项目都将用到Protocol Buffers,因此首先发布Protocol Buffers。
据美国国际数据公司统计,仅美国一个国家就有超过7000个数据中心,服务器总数在2010年前将增至1580万台。麦肯锡咨询公司和智囊机构“正常运行时间机构”最近一项调查则表明,全球范围内,数据中心耗电量逐年递增。数据中心2000年消耗全球电力的0.6%,到2005年,这一数字已升至1%。麦肯锡的调查报告指出,全球范围内,数据中心一年的二氧化碳排量比阿根廷或荷兰一个国家的排量还高。
为此,国外专家号召网民减少网络购物行为,而传统的商场购物看起来更为环保。对于国外专家的分析,不少用户嗤之以鼻,商场也要发电、发电需要煤炭,去商场购物同样不环保。这样的观点并不在少数。可以肯定的是,互联网前进的速度仍会一如既往,并不会因为机房发出沉默的嗡嗡声及持续升高的碳排放而减慢脚步。就像汽车发展并没有因能源消耗或尾气污染等问题而停滞不前。
但,汽车已经开始寻求绿色环保能源发展方向,小排量、低污染的汽车将会成为未来趋势。那些服务器消耗大户们及服务器生产商,看看汽车行业发展,再看看今天的自己,未来是否也应该向汽车行业学习学习?
其实,寻求环保绿色的IT世界已经成为主流IT厂商积极探寻的方向。今年在这方面的表现也相对突出,但是,有专家却提出值得关注的问题。ESG高级分析师 Steve Duplessie提醒说,一些企业提出绿色概念,可以说是受经济利益驱使,而非为生态环境考虑。厂商购买低能耗产品只是为了在能耗上节省支出。当数据中心拥挤不堪时,我们才会想到提高能源效率,减少设备占地面积;或者是,楼房里再也装不下更多的电源时,我们才会想到要使用节电的产品。可以说,企业们关心的“绿色”是绿色的钞票。
如何解决IT快速发展,数据爆炸与无烟工业对环境破坏的矛盾是个庞大的课题,这里无法解决,但Steve Duplessie给出一个简单可行的方法:放弃夜间进行增量备份、周末进行全面备份的做法。类似这样的小小改变,往往就能极大降低存储能耗,这就是我们让IT更绿色的举手之劳。
各位站长朋友,如何做个绿色环保的站呢,其实不难,上面已经提到了:放弃夜间进行增量备份、周末进行全面备份的做法。在目前,我们能做的只有这么多,呵呵。为了绿色的地球,大家一起努力吧!
DVLabs 称,该漏洞系研究者发现,DVLabs 已经向该研究者支付费用购买这一发现并做出验证,DVLabs 同时立即将该漏洞报告了 Firefox 安全团队。虽然 DVLabs 在 Firefox 推出安全补丁之前不会公布漏洞细节,但声称,这个同时会影响 Firefox 2 的安全漏洞会在用户参与下执行一些恶意代码。Mozilla 称会推出相关补丁。
本文国际来源: http://news.cnet.com/8301-10789_3-9972207-57.html?tag=nefd.top
点击下载 Mozilla Firefox 简体中文正式版3.0 Final
[PHP-Core-Safe]
allow_url_fopen = On
;ini
; 是否允许打开远程文件
allow_url_include = Off
;SYS
; 是否允许include/require远程文件。
disable_classes =
;ini
; 该指令接受一个用逗号分隔的类名列表,以禁用特定的类。
disable_functions =
;ini
; 该指令接受一个用逗号分隔的函数名列表,以禁用特定的函数。
enable_dl = On
;SYS
; 是否允许使用dl()函数。dl()函数仅在将PHP作为apache模块安装时才有效。
; 禁用dl()函数主要是出于安全考虑,因为它可以绕过open_basedir指令的限制。
; 在安全模式下始终禁用dl()函数,而不管此处如何设置。
expose_php = On
;ini
; 是否暴露PHP被安装在服务器上的事实(在http头中加上其签名)。
; 它不会有安全上的直接威胁,但它使得客户端知道服务器上安装了PHP。
open_basedir =
;SYS
; 将PHP允许操作的所有文件(包括文件自身)都限制在此组目录列表下。
error_prepend_string = ;"<font color=#f00>"
; 用于错误信息前输出的字符串
error_append_string = ;"</font>"
; 用于错误信息后输出的字符串
xmlrpc_errors = Off
xmlrpc_error_number = 0
; 尚无文档
[PHP-Core-Logging]
define_syslog_variables = Off
; 是否定义各种系统日志变量,如:$LOG_PID, $LOG_CRON 等等。
; 关掉它以提高效率的好主意。
; 你可以在运行时调用define_syslog_variables()函数来定义这些变量。
error_log =
; 将错误日志记录到哪个文件中。该文件必须对Web服务器用户可写。
; syslog 表示记录到系统日志中(NT下的事件日志, Unix下的syslog(3))
; 如果此处未设置任何值,则错误将被记录到Web服务器的错误日志中。
log_errors = Off
; 是否在日志文件里记录错误,具体在哪里记录取决于error_log指令。
; 强烈建议你在最终发布的web站点时使用日志记录错误而不是直接输出,
; 这样可以让你既知道那里出了问题,又不会暴露敏感信息。
log_errors_max_len = 1024
; 设置错误日志中附加的与错误信息相关联的错误源的最大长度。
; 这里设置的值对显示的和记录的错误以及$php_errormsg都有效。
; 设为 0 可以允许无限长度。
ignore_repeated_errors = Off
; 记录错误日志时是否忽略重复的错误信息。
; 错误信息必须出现在同一文件的同一行才被被视为重复。
ignore_repeated_source = Off
; 是否在忽略重复的错误信息时忽略重复的错误源。
[PHP-Core-Mail]
; 要使邮件函数可用,PHP必须在编译时能够访问sendmail程序。
; 如果使用其它的邮件程序,如qmail或postfix,确保使用了相应的sendmail包装。
; PHP首先会在系统的PATH环境变量中搜索sendmail,接着按以下顺序搜索:
; /usr/bin:/usr/sbin:/usr/etc:/etc:/usr/ucblib:/usr/lib
; 强烈建议在PATH中能够找到sendmail。
; 另外,编译PHP的用户必须能够访问sendmail程序。
SMTP = "localhost"
; mail()函数中用来发送邮件的SMTP服务器的主机名称或者IP地址。仅用于win32。
smtp_port = 25
; SMTP服务器的端口号。仅用于win32。
sendmail_from =
; 发送邮件时使用的"From:"头中的邮件地址。仅用于win32
; 该选项还同时设置了"Return-Path:"头。
sendmail_path = "-t -i"
;SYS
; 仅用于unix,也可支持参数(默认的是'sendmail -t -i')
; sendmail程序的路径,通常为"/usr/sbin/sendmail或/usr/lib/sendmail"。
; configure脚本会尝试找到该程序并设定为默认值,但是如果失败的话,可以在这里设定。
; 不使用sendmail的系统应将此指令设定为sendmail替代程序(如果有的话)。
; 例如,Qmail用户通常可以设为"/var/qmail/bin/sendmail"或"/var/qmail/bin/qmail-inject"。
; qmail-inject 不需要任何选项就能正确处理邮件。
mail.force_extra_parameters =
; 作为额外的参数传递给sendmail库的强制指定的参数附加值。
; 这些参数总是会替换掉mail()的第5个参数,即使在安全模式下也是如此。
[PHP-Core-ResourceLimit]
default_socket_timeout = 60
; 默认socket超时(秒)
max_execution_time = 30
; 每个脚本最大允许执行时间(秒),0 表示没有限制。
; 这个参数有助于阻止劣质脚本无休止的占用服务器资源。
; 该指令仅影响脚本本身的运行时间,任何其它花费在脚本运行之外的时间,
; 如用system()/sleep()函数的使用、数据库查询、文件上传等,都不包括在内。
; 在安全模式下,你不能用ini_set()在运行时改变这个设置。
memory_limit = 16M
; 一个脚本所能够申请到的最大内存字节数(可以使用K和M作为单位)。
; 这有助于防止劣质脚本消耗完服务器上的所有内存。
; 要能够使用该指令必须在编译时使用"--enable-memory-limit"配置选项。
; 如果要取消内存限制,则必须将其设为 -1 。
; 设置了该指令后,memory_get_usage()函数将变为可用。
max_input_time = -1
; 每个脚本解析输入数据(POST, GET, upload)的最大允许时间(秒)。
; -1 表示不限制。
post_max_size = 8M
; 允许的POST数据最大字节长度。此设定也影响到文件上传。
; 如果POST数据超出限制,那么___FCKpd___0
POST和
___FCKpd___0
FILES将会为空。
; 要上传大文件,该值必须大于upload_max_filesize指令的值。
; 如果启用了内存限制,那么该值应当小于memory_limit指令的值。
realpath_cache_size = 16K
;SYS
; 指定PHP使用的realpath(规范化的绝对路径名)缓冲区大小。
; 在PHP打开大量文件的系统上应当增大该值以提高性能。
realpath_cache_ttl = 120
;SYS
; realpath缓冲区中信息的有效期(秒)。
; 对文件很少变动的系统,可以增大该值以提高性能。
[PHP-Core-FileUpLoad]
file_uploads = On
;SYS
; 是否允许HTTP文件上传。
; 参见upload_max_filesize, upload_tmp_dir, post_max_size指令
upload_max_filesize = 2M
; 允许上传的文件的最大尺寸。
upload_tmp_dir =
;SYS
; 文件上传时存放文件的临时目录(必须是PHP进程用户可写的目录)。
; 如果未指定则PHP使用系统默认的临时目录。
[PHP-Core-MagicQuotes]
; PHP6将取消魔术引号,相当于下列指令全部为 Off
magic_quotes_gpc = On
; 是否对输入的GET/POST/Cookie数据使用自动字符串转义( ' " \ NULL )。
; 这里的设置将自动影响
___FCKpd___0
GEST
___FCKpd___0
POST
___FCKpd___0
COOKIE 数组的值。
; 若将本指令与magic_quotes_sybase指令同时打开,则仅将单引号(')转义为(''),
; 其它特殊字符将不被转义,即( " \ NULL )将保持原样!!
; 建议关闭此特性,并使用自定义的过滤函数。
magic_quotes_runtime = Off
; 是否对运行时从外部资源产生的数据使用自动字符串转义( ' " \ NULL )。
; 若打开本指令,则大多数函数从外部资源(数据库,文本文件等)返回数据都将被转义。
; 例如:用SQL查询得到的数据,用exec()函数得到的数据,等等
; 若将本指令与magic_quotes_sybase指令同时打开,则仅将单引号(')转义为(''),
; 其它特殊字符将不被转义,即( " \ NULL )将保持原样!!
; 建议关闭此特性,并视具体情况使用自定义的过滤函数。
magic_quotes_sybase = Off
; 是否采用Sybase形式的自动字符串转义(用 '' 表示 ')
[PHP-Core-HighLight]
highlight.bg = "#FFFFFF"
highlight.comment = "#FF8000"
highlight.default = "#0000BB"
highlight.html = "#000000"
highlight.keyword = "#007700"
highlight.string = "#DD0000"
; 语法高亮模式的色彩(通常用于显示 .phps 文件)。
; 只要能被<font color=xxx>接受的东西就能正常工作。
[PHP-Core-Langue]
short_open_tag = On
; 是否允许使用"<? ?>"短标识。否则必须使用"<?php ?>"长标识。
; 除非你的php程序仅在受控环境下运行,且只供自己使用,否则请不要使用短标记。
; 如果要和XML结合使用PHP,可以选择关闭此选项以方便直接嵌入"<?xml ... ?>",
; 不然你必须用PHP来输出:<? echo '<?xml version="1.0"'; ?>
; 本指令也会影响到缩写形式"<?=",它和"<? echo"等价,要使用它也必须打开短标记。
asp_tags = Off
; 是否允许ASP风格的标记"<% %>",这也会影响到缩写形式"<%="。
; PHP6中将删除此指令
arg_separator.output = "&"
; PHP所产生的URL中用来分隔参数的分隔符。
; 另外还可以用"&"或","等等。
arg_separator.input = "&"
; PHP解析URL中的变量时使用的分隔符列表。
; 字符串中的每一个字符都会被当作分割符。
; 另外还可以用",&"等等。
allow_call_time_pass_reference = On
; 是否强迫在函数调用时按引用传递参数(每次使用此特性都会收到一条警告)。
; php反对这种做法,并在将来的版本里不再支持,因为它影响到了代码的整洁。
; 鼓励的方法是在函数声明里明确指定哪些参数按引用传递。
; 我们鼓励你关闭这一选项,以保证你的脚本在将来版本的语言里仍能正常工作。
auto_globals_jit = On
; 是否仅在使用到
___FCKpd___0
SERVER和
___FCKpd___0
ENV变量时才创建(而不是在脚本一启动时就自动创建)。
; 如果并未在脚本中使用这两个数组,打开该指令将会获得性能上的提升。
; 要想该指令生效,必须关闭register_globals和register_long_arrays指令。
auto_prepend_file =
auto_append_file =
; 指定在主文件之前/后自动解析的文件名。为空表示禁用该特性。
; 该文件就像调用了include()函数被包含进来一样,因此会使用include_path指令的值。
; 注意:如果脚本通过exit()终止,那么自动后缀将不会发生。
variables_order = "EGPCS"
; PHP注册 Environment, GET, POST, Cookie, Server 变量的顺序。
; 分别用 E, G, P, C, S 表示,按从左到右注册,新值覆盖旧值。
; 举例说,设为"GP"将会导致用POST变量覆盖同名的GET变量,
; 并完全忽略 Environment, Cookie, Server 变量。
; 推荐使用"GPC"或"GPCS",并使用getenv()函数访问环境变量。
register_globals = Off
; 是否将 E, G, P, C, S 变量注册为全局变量。
; 打开该指令可能会导致严重的安全问题,除非你的脚本经过非常仔细的检查。
; 推荐使用预定义的超全局变量:
___FCKpd___0
ENV,
___FCKpd___0
GET,
___FCKpd___0
POST,
___FCKpd___0
COOKIE,
___FCKpd___0
SERVER
; 该指令受variables_order指令的影响。
; PHP6中已经删除此指令。
register_argc_argv = On
; 是否声明$argv和$argc全局变量(包含用GET方法的信息)。
; 建议不要使用这两个变量,并关掉该指令以提高性能。
register_long_arrays = On
; 是否启用旧式的长式数组(HTTP_*_VARS)。
; 鼓励使用短式的预定义超全局数组,并关闭该特性以获得更好的性能。
; PHP6中已经删除此指令。
always_populate_raw_post_data = Off
; 是否总是生成$HTTP_RAW_POST_DATA变量(原始POST数据)。
; 否则,此变量仅在遇到不能识别的MIME类型的数据时才产生。
; 不过,访问原始POST数据的更好方法是 php://input 。
; $HTTP_RAW_POST_DATA对于enctype="multipart/form-data"的表单数据不可用。
unserialize_callback_func =
; 如果解序列化处理器需要实例化一个未定义的类,
; 这里指定的回调函数将以该未定义类的名字作为参数被unserialize()调用,
; 以免得到不完整的"__PHP_Incomplete_Class"对象。
; 如果这里没有指定函数,或指定的函数不包含(或实现)那个未定义的类,将会显示警告信息。
; 所以仅在确实需要实现这样的回调函数时才设置该指令。
; 若要禁止这个特性,只需置空即可。
y2k_compliance = On
; 是否强制打开2000年适应(可能在非Y2K适应的浏览器中导致问题)。
zend.ze1_compatibility_mode = Off
; 是否使用兼容Zend引擎I(PHP 4.x)的模式。
; 这将影响对象的复制、构造(无属性的对象会产生FALSE或0)、比较。
; 兼容模式下,对象将按值传递,而不是默认的按引用传递。
precision = 14
; 浮点型数据显示的有效位数。
serialize_precision = 100
; 将浮点型和双精度型数据序列化存储时的精度(有效位数)。
; 默认值能够确保浮点型数据被解序列化程序解码时不会丢失数据。
[PHP-Core-OutputControl]
; 输出控制函数很有用,特别是在已经输出了信息之后再发送HTTP头的情况下。
; 输出控制函数不会作用于header()或setcookie()等函数发送的HTTP头,
; 而只会影响类似于echo()函数输出的信息和嵌入在PHP代码之间的信息。
implicit_flush = Off
; 是否要求PHP输出层在每个输出块之后自动刷新数据。
; 这等效于在每个 print()、echo()、HTML块 之后自动调用flush()函数。
; 打开这个选项对程序执行的性能有严重的影响,通常只推荐在调试时使用。
; 在CLI SAPI的执行模式下,该指令默认为 On 。
output_buffering = 0
; 输出缓冲区大小(字节)。建议值为4096~8192。
; 输出缓冲允许你甚至在输出正文内容之后再发送HTTP头(包括cookies)。
; 其代价是输出层减慢一点点速度。
; 设置输出缓冲可以减少写入,有时还能减少网络数据包的发送。
; 这个参数的实际收益很大程度上取决于你使用的是什么Web服务器以及什么样的脚本。
output_handler =
; 将所有脚本的输出重定向到一个输出处理函数。
; 比如,重定向到mb_output_handler()函数时,字符编码将被透明地转换为指定的编码。
; 一旦你在这里指定了输出处理程序,输出缓冲将被自动打开(output_buffering=4096)。
; 注意0: 此处仅能使用PHP内置的函数,自定义函数应在脚本中使用ob_start()指定。
; 注意1: 可移植脚本不能依赖该指令,而应使用ob_start()函数明确指定输出处理函数。
; 使用这个指令可能会导致某些你不熟悉的脚本出错。
; 注意2: 你不能同时使用"mb_output_handler"和"ob_iconv_handler"两个输出处理函数。
; 你也不能同时使用"ob_gzhandler"输出处理函数和zlib.output_compression指令。
; 注意3: 如果使用zlib.output_handler指令开启zlib输出压缩,该指令必须为空。
更多服务器部署技术
Windows 2003 IIS下配置MySQL+PHP+ISAPI_Rewrite+Zend+Xcache
php缓存加速器eAccelerator配置详解
php缓存加速XCache 的INI配置详解
;;;;;;;;;;;;;;
;; 简介 ;;
;;;;;;;;;;;;;;
; 本文并非是对英文版 php.ini 的简单翻译,而是参考了众多资料以后,结合自己的理解,增加了许多内容,
; 包括在原有 php.ini 基础上增加了一些实用模块的配置说明,同时对文件内容的安排进行了调整。
; 由于作者不喜欢 no-free 的玩意儿,所以删除了除 MySQL 和 PostgreSQL 以外的其他数据库模块配置选项。
;;;;;;;;;;;;;;;;;
;; 关于php.ini ;;
;;;;;;;;;;;;;;;;;
; 这个文件必须命名为'php.ini'并放置在httpd.conf中的PHPIniDir指令指定的目录中。
; 最新版本的php.ini可以在下面两个位置查看:
; http://cvs.php.net/viewvc.cgi/php-src/php.ini-recommended?view=co
; http://cvs.php.net/viewvc.cgi/php-src/php.ini-dist?view=co
;;;;;;;;;;;;
;; 语法 ;;
;;;;;;;;;;;;
; 该文件的语法非常简单。空白字符和以分号开始的行被简单地忽略。
; 章节标题(例如: [php])也被简单地忽略,即使将来它们可能有某种意义。
;
; 设置指令的格式如下:
; directive = value
; 指令名(directive)是大小写敏感的!所以"foo=bar"不同于"FOO=bar"。
; 值(value)可以是:
; 1. 用引号界定的字符串(如:"foo")
; 2. 一个数字(整数或浮点数,如:0, 1, 34, -1, 33.55)
; 3. 一个PHP常量(如:E_ALL, M_PI)
; 4. 一个INI常量(On, Off, none)
; 5. 一个表达式(如:E_ALL & ~E_NOTICE)
;
; INI文件中的表达式仅使用:位运算符、逻辑非、圆括号:
; | 位或
; & 位与
; ~ 位非
; ! 逻辑非
;
; 布尔标志用 On 表示打开,用 Off 表示关闭。
;
; 一个空字符串可以用在等号后不写任何东西表示,或者用 none 关键字:
; foo = ; 将foo设为空字符串
; foo = none ; 将foo设为空字符串
; foo = "none" ; 将foo设为字符串'none'
;
; 如果你在指令值中使用动态扩展(PHP扩展或Zend扩展)中的常量,
; 那么你只能在加载这些动态扩展的指令行之后使用这些常量。
;;;;;;;;;;;;;;;;;;
;; httpd.conf ;;
;;;;;;;;;;;;;;;;;;
; 还可以在httpd.conf中覆盖php.ini的值,以进行更灵活的配置:
; php_value name value ;设置非bool型的指令,将value设为none则清除先前的设定
; php_flag name on|off ;仅用于设置bool型的指令
;
; PHP常量(如E_ALL)仅能在php.ini中使用,在httpd.conf中必须使用相应的掩码值。
; 带"SYS"标志的指令只能在httpd.conf中的全局配置部分使用,
; 带"ini"标志的指令不能在httpd.conf中使用,它们仅能用于php.ini中。
;==========================================
;;配置指令详解
;==========================================
; 以下每个指令的设定值都与 PHP-5.2 内建的默认值相同。
; 也就是说,如果'php.ini'不存在,或者你删掉了某些行,默认值与之相同。
;;;;;;;;;;;;;;
;; Apache ;;
;;;;;;;;;;;;;;
[Apache]
; 仅在将PHP作为Apache模块时才有效。
engine = On
; 是否启用PHP解析引擎。
; 可以在httpd.conf中基于目录或者虚拟主机来打开或者关闭PHP解析引擎。
last_modified = Off
; 是否在Last-Modified应答头中放置该PHP脚本的最后修改时间。
xbithack = Off
; 是否不管文件结尾是什么,都作为PHP可执行位组来解析。
child_terminate = Off
; PHP脚本在请求结束后是否允许使用apache_child_terminate()函数终止子进程。
; 该指令仅在UNIX平台上将PHP安装为Apache1.3的模块时可用。其他情况下皆不存在。
;;;;;;;;;;;;;;;
;; PHP核心 ;;
;;;;;;;;;;;;;;;
[PHP-Core-DateTime]
; 前四个配置选项目前仅用于date_sunrise()和date_sunset()函数。
date.default_latitude = 31.7667
; 默认纬度
date.default_longitude = 35.2333
; 默认经度
date.sunrise_zenith = 90.583333
; 默认日出天顶
date.sunset_zenith = 90.583333
; 默认日落天顶
date.timezone =
; 未设定TZ环境变量时用于所有日期和时间函数的默认时区。
; 中国大陆应当使用"PRC"
; 应用时区的优先顺序为:
; 1. 用date_default_timezone_set()函数设定的时区(如果设定了的话)
; 2. TZ 环境变量(如果非空的话)
; 3. 该指令的值(如果设定了的话)
; 4. PHP自己推测(如果操作系统支持)
; 5. 如果以上都不成功,则使用 UTC
[PHP-Core-Assert]
assert.active = On
; 是否启用assert()断言评估
assert.bail = Off
; 是否在发生失败断言时中止脚本的执行
assert.callback =
; 发生失败断言时执行的回调函数
assert.quiet_eval = Off
; 是否使用安静评估(不显示任何错误信息,相当于error_reporting=0)。
; 若关闭则在评估断言表达式的时候使用当前的error_reporting指令值。
assert.warning = On
; 是否对每个失败断言都发出警告
[PHP-Core-SafeMode]
; 安全模式是为了解决共享服务器的安全问题而设立的。
; 但试图在PHP层解决这个问题在结构上是不合理的,
; 正确的做法应当是修改web服务器层和操作系统层。
; 因此在PHP6中废除了安全模式,并打算使用open_basedir指令取代之。
safe_mode = Off
;SYS
; 是否启用安全模式。
; 打开时,PHP将检查当前脚本的拥有者是否和被操作的文件的拥有者相同,
; 相同则允许操作,不同则拒绝操作。
safe_mode_gid = Off
;SYS
; 在安全模式下,默认在访问文件时会做UID比较检查。
; 但有些情况下严格的UID检查反而是不适合的,宽松的GID检查已经足够。
; 如果你想将其放宽到仅做GID比较,可以打开这个参数。
safe_mode_allowed_env_vars = "PHP_"
;SYS
; 在安全模式下,用户仅可以更改的环境变量的前缀列表(逗号分隔)。
; 允许用户设置某些环境变量,可能会导致潜在的安全漏洞。
; 注意: 如果这一参数值为空,PHP将允许用户更改任意环境变量!
safe_mode_protected_env_vars = "LD_LIBRARY_PATH"
;SYS
; 在安全模式下,用户不能更改的环境变量列表(逗号分隔)。
; 这些变量即使在safe_mode_allowed_env_vars指令设置为允许的情况下也会得到保护。
safe_mode_exec_dir = "/usr/local/php/bin"
;SYS
; 在安全模式下,只有该目录下的可执行程序才允许被执行系统程序的函数执行。
; 这些函数是:system, escapeshellarg, escapeshellcmd, exec, passthru,
; proc_close, proc_get_status, proc_nice, proc_open, proc_terminate, shell_exec
safe_mode_include_dir =
;SYS
; 在安全模式下,该组目录和其子目录下的文件被包含时,将跳过UID/GID检查。
; 换句话说,如果此处的值为空,任何UID/GID不符合的文件都不允许被包含。
; 这里设置的目录必须已经存在于include_path指令中或者用完整路径来包含。
; 多个目录之间用冒号(Win下为分号)隔开。
; 指定的限制实际上是一个前缀,而非一个目录名,
; 也就是说"/dir/incl"将允许访问"/dir/include"和"/dir/incls"
; 如果您希望将访问控制在一个指定的目录,那么请在结尾加上斜线。
sql.safe_mode = Off
;SYS
; 是否使用SQL安全模式。
; 如果打开,指定默认值的数据库连接函数将会使用这些默认值代替支持的参数。
; 对于每个不同数据库的连接函数,其默认值请参考相应的手册页面。
php5.2 的 php.ini 中文版(下)
更多服务器部署技术
Windows 2003 IIS下配置MySQL+PHP+ISAPI_Rewrite+Zend+Xcache
php缓存加速器eAccelerator配置详解
php缓存加速XCache 的INI配置详解
在网上看到很多篇文章介绍在Vista下安装MySQL,自己试过很多次都没有成功,经过别人帖子的指点,终于找到了成功安装MYSQL的方法,现在分享如下:
1、去官方下载MYSQL 5.0,下载地址:http://http://dev.mysql.com/downloads/ 下载5.0版本的。
2、修改防火墙的设置,在允许例外里添加新的端口,名字为mysql,开放的端口为TCP 3306。
这个大家应该都会,在Vista控制面板的Windows防火墙里面,点击“更改设置”-“例外”,点击“添加端口”就可以。
截图如下:
3、安装MYSQL 5.0,可以自己修改安装路径和组件等。
4、安装完成后,Mysql server instance config wizard应该是启动不了的,下面的工作就是为了解决这个问题的,因为这是配置Mysql的唯一途径。
5、到http://angusj.com/resourcehacker/ 下载Resource Hacker得简体中文版(如果你看的懂英文,那就直接下原版的)。
6、解压rh_chinese_big5.zip ,执行 ResHacker.exe
7、打开MySQLInstanceConfig.exe (在安裝 MySQL 的bin 目录中) ,可以用鼠标直接把exe等资源文件拖到Resource Hacker窗体上面。
8、左侧展开「24」→「1」→「1033」
9、右侧找到 这行
10、将 level="asAdministrator" 改成 level="requireAdministrator"
11、重新编译
12、保存后关闭 (如果不能保存,另存在 bin 目录外,然后覆盖回來也可以)
13、这时MySQLInstanceConfig.exe,就可以正常的配置了。
以下来介绍eAccelerator及eAccelerator详细配置
目录:
一、eAccelerator介绍
1、背景
2、原理
二、安装和配置
1、支持平台
2、系统要求
3、安装
4、php.ini文件配置
5、验证安装
三、使用eAccelerator开发PHP代码
1、API文档和接口说明
2、开发范例
四、附录和参考资料
一、eAccelerator介绍
1、背景
eAccelerator 是一个免费开源的PHP加速、优化、编译和动态缓存的项目,它可以通过缓存PHP代码编译后的结果来提高PHP脚本的性能,使得一向很复杂和离我们很远的PHP脚本编译问题完全得到解决。通过使用eAccelerator,可以优化你的PHP代码执行速度,降低服务器负载,可以提高PHP应用执行速度最高达10倍。
eAccelerator 项目诞生于2004年,当时它是作为 Turck MMCache 项目的一个分支提出并投入开发的。 Turck MMCache 由 Dmitry Stogov 开发,是个非常优秀的PHP内存缓存加速系统,如今仍然有很大部分 eAccelerator 的代码应用到该项目中,目前该项目有很长时间没有更新了,对于最新的PHP5.x的支持还未推出。
2、原理
eAccelerator 通过把经过编译后的PHP代码缓存到共享内存中,并在用户访问的时候直接调用从而起到高效的加速作用。它的效率非常高,从创建共享内存到查找编译后的代码都在非常短的时间内完成,对于不能缓存到共享内存中的文件和代码,eAccelerator还可以把他们缓存到系统磁盘上。
eAccelerator 同样还支持PHP代码的编译和解释执行,你可以通过encoder.php脚本来对php代码进行编译达到保护代码的目的,经过编译后的代码必须运行在安装了eAccelerator的环境下。eAccelerator编译后的代码不能被反编译,它不象其他一些编译工具那样可以进行反编译,这将使得代码更加安全和高效。
二、eAccelerator安装配置
1、支持平台
由于aAccelerator提供了大部分基于共享内存的API,所以在*nix的平台上将得到更好的支持,虽然也发布了基于windows平台的binary版本,但我在这里就只提供基于*nix平台的配置和说明,目前可以支持的平台包括Linux, FreeBSD, OpenBSD, Mac OS X, Solaris, AIX en HP-UX。
2、系统要求
php4 or php5
autoconf
automake
libtool
m4
eAccelerator 只支持使用 mod_php 或者 fastcgi mode 安装的PHP
3、安装
先去eAccelerator官方下载最新版的源码包:eaccelerator-0.9.5-beta.tar.bz2
#cd eaccelerator-0.9.5-beta2
#export PHP_PREFIX="/usr/local" (把PHP安装目录导入到环境变量,FreeBSD默认是/usr/local)
#$PHP_PREFIX/bin/phpize
#./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config
#make
#make install
4、ini文件配置
安装完成,下面开始配置php.ini文件,eAccelerator提供了两种配置和调用方式,分别如下。
安装为 Zend extension 模式:
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.log_file = "/var/log/httpd/eaccelerator_log"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
如果你使用了thread safe模式安装的PHP,你必须使用 “zend_extension_ts” 替换第一行的 “zend_extension”.
安装为 PHP extension 模式:(这是大部分采用的方式)
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.log_file = "/var/log/httpd/eaccelerator_log"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
有关php.ini文件的详细配置说明,请参照源码目录的README文档或者访问官方文档:ini setting
完成安装配置后,我们最后要创建缓存目录
#chmod 777 /tmp/eaccelerator
5、验证安装结果
通过浏览器访问您的phpinfo()页面或者运行 php -i 得到php配置信息,里面如果看到类似下面的信息就表示安装成功了。
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
with eAccelerator v0.9.5-beta2, Copyright (c) 2004-2006 eAccelerator, by eAccelerator
我的机器上同时还安装了Zend Optimizer3.0.1,所以看到的信息如下:
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
with eAccelerator v0.9.5-beta2, Copyright (c) 2004-2006 eAccelerator, by eAccelerator
with Zend Extension Manager v1.0.10, Copyright (c) 2003-2006, by Zend Technologies
with Zend Optimizer v3.0.1, Copyright (c) 1998-2006, by Zend Technologies
如果你打开了eAccelerator的debug选项,可以从日志中看到类似下面的信息
EACCELERATOR hit: "/var/www/toplee.com/blog/index.php"
EACCELERATOR hit: "/var/www/toplee.com/blog/wp-blog-header.php"
EACCELERATOR hit: "/var/www/toplee.com/blog/wp-config.php"
EACCELERATOR hit: "/var/www/toplee.com/blog/wp-settings.php"
EACCELERATOR hit: "/var/www/toplee.com/blog/wp-content/plugins/wp-cache/wp-cache-phase1.php"
...
以上信息表示文件都得到了缓存和命中。
至此,我们就完成了全部的安装和配置,好好享受eAccelerator带给你的惊喜吧,根据Michael的测试,效果的确相当的好。
三、在PHP中可以使用eAccelerator的API开发
1、API和文档说明:
eAccelerator提供了便捷便捷而又稳定的本机缓存实现方式,由于大部分代码实现基于共享内存,所以只能在*nix平台中使用,Windows平台Michael就暂时不知道何时有这方面的支持了。
eAccelerator提供如下的API接口和文件:(下述文件均在源码包的doc/php/目录下)
文件列表:
dasm.php
encoder.php
info.php
loader.php
session.php
shared_memory.php
接口列表:
void eaccelerator_cache_output (string $key, string $eval_code, [int $ttl = 0])
void eaccelerator_cache_page (string $key, [int $ttl = 0])
void eaccelerator_cache_result (string $key, string $code, [int $ttl = 0])
void eaccelerator_caching (boolean $flag)
void eaccelerator_clean ()
void eaccelerator_clear ()
array eaccelerator_dasm_file (mixed $filename)
mixed eaccelerator_encode (mixed $src, [mixed $prefix = ''], [string $pre_content = ''], [string $post_content = ''])
void eaccelerator_gc ()
mixed eaccelerator_get (string $key)
array eaccelerator_info ()
array eaccelerator_list_keys ()
void eaccelerator_load ()
boolean eaccelerator_lock (string $key)
void eaccelerator_optimizer (boolean $flag)
void eaccelerator_purge ()
boolean eaccelerator_put (string $key, mixed $value, [int $ttl = 0])
array eaccelerator_removed_scripts ()
boolean eaccelerator_rm (string $key)
void eaccelerator_rm_page (string $key)
boolean eaccelerator_set_session_handlers ()
boolean eaccelerator_unlock (string $key)
有关上述文档详细说明请参考官方文档:API Documents
下面有部分网友翻译后的接口说明:
将 $value 以 $key 为键名存进缓存(php4下支持对像类型,看源码好像zend2里不支持了),$ttl 是这个缓存的生命周期,单位是秒,省略该参数或指定为 0 表示不限时,直到服务器重启清空为止。
eaccelerator_get($key)
根据 $key 从缓存中返回相应的 eaccelerator_put() 存进去的数据,如果这项缓存已经过期或不存在那么返回值是 NULL
eaccelerator_rm($key)
根据 $key 移除缓存
eaccelerator_gc()
移除清理所有已过期的 key
eaccelerator_lock($key)
为 $key 加上锁定操作,以保证多进程多线程操作时数据的同步。需要调用 eaccelerator_unlock($key) 来释放这个锁或等待程序请求结束时自动释放这个锁。
例如:
eaccelerator_lock("count");
eaccelerator_put("count",eaccelerator_get("count")+1));
?>
eaccelerator_unlock($key)
根据 $key 释放锁
eaccelerator_cache_output($key, $eval_code, $ttl=0)
将 $eval_code 代码的输出缓存 $ttl 秒,($ttl参数同 eacclerator_put)
例如:
eaccelerator_cache_result($key, $eval_code, $ttl=0)
将 $eval_code 代码的执行结果缓存 $ttl 秒,($ttl参数同 eacclerator_put),类似 cache_output
例如:
eaccelerator_cache_page($key, $ttl=0)
将当前整页缓存 $ttl 秒。
例如:
eaccelerator_cache_page($_SERVER['PHP_SELF'].'?GET='.serialize($_GET),30);
echo time();
phpinfo();
?>
eaccelerator_rm_page($key)
删除由 eaccelerator_cache_page() 执行的缓存,参数也是 $key
2、PHP代码中使用eAccelerator加速
下面有一个测试的代码,你可以测试一下eAccelerator强大的威力:(该代码在 cli 模式下可能无效)
var $pro = 'hello';
function test_cache() {
echo "Object Created!
\n";
}
function func() {
echo ', the world!';
}
function now($t) {
echo date('Y-m-d H:i:s', $t);
}
}
$tt = eaccelerator_get("test_tt");
if (!$tt)
{
$tt = new test_cache;
eaccelerator_put("test_tt", $tt);
echo "no cached!
\n";
}
else {
echo "cached
\n";
}
echo $tt->pro;
$tt->func();
$tt->now(time() + 86400);
?>
另外,据说在著名的vBulletin 3.60Beta版里面已经集成了对eAccelerator的支持,下面是一段来自vBulletin里面的代码
// eAccelerator
/**
* Class for fetching and initializing the vBulletin datastore from eAccelerator
*
* @package vBulletin
* @version $Revision: 0.1 $
* @date $Date: 2005/06/12 13:14:18 $
*/
class vB_Datastore_eAccelerator extends vB_Datastore
{
/**
* Fetches the contents of the datastore from eAccelerator
*
* @param array Array of items to fetch from the datastore
*
* @return void
*/
function fetch($itemarray)
{
if (!function_exists('eaccelerator_get'))
{
trigger_error("eAccelerator not installed", E_USER_ERROR);
}
foreach ($this->defaultitems AS $item)
{
$this->do_fetch($item);
}
if (is_array($itemarray))
{
foreach ($itemarray AS $item)
{
$this->do_fetch($item);
}
}
$this->check_options();
// set the version number variable
$this->registry->versionnumber =& $this->registry->options['templateversion'];
}
/**
* Fetches the data from shared memory and detects errors
*
* @param string title of the datastore item
*
* @return void
*/
function do_fetch($title)
{
$data = eaccelerator_get($title);
if ($data === null)
{ // appears its not there, lets grab the data, lock the shared memory and put it in
$data = '';
$dataitem = $this->dbobject->query_first("
SELECT title, data FROM " . TABLE_PREFIX . "datastore
WHERE title = '" . $this->dbobject->escape_string($title) ."'
");
if (!empty($dataitem['title']))
{
$data =& $dataitem['data'];
$this->build($dataitem['title'], $dataitem['data']);
}
}
$this->register($title, $data);
}
/**
* Updates the appropriate cache file
*
* @param string title of the datastore item
*
* @return void
*/
function build($title, $data)
{
if (!function_exists('eaccelerator_put'))
{
trigger_error("eAccelerator not installed", E_USER_ERROR);
}
eaccelerator_lock($title);
eaccelerator_put($title, $data);
eaccelerator_unlock($title);
}
}
四、附录和参考资料
eAccelerator 官方网站 :http://eaccelerator.net
Websites using eAccelerator ?
http://www.advfn.com/ (2006/03/03) Advanced Financial Network, serves over 7 million page hits per day.
http://www.domaincity.co.uk/ (2005/01/29) Andrew Hutchings - Linux Guru - Just a quick message to say we are now using eaccelerator as a replacement for mmcache on 2 of our 3 node round robin clusters, 2.5million hits per day. We will be doubling this in the next few week, as well as implementing new clusters.
http://www.ets-online.de/ (2005/02/07) Denny Reeh - System Developer - The e/t/s didactic media provides an elearning server (Distance Learning System) written in PHP. We are hosting the systems for our customers mainly by ourself. So we have 5 live-servers (freebsd, apache2, php4, eaccelerator) with 5.5 million hits per month. First without eAccelerator we should have installed more servers for good performance and secondly we improve the customer convenience by quartering the medium response time of a script.
http://www.gorgoyle.com/ (2005/08/03) Gorgoyle.com is Yet Another Debian Personal Server with just a few lost Internet wanderers passing by, powered by a glorious Celeron 433 that needed some fresh air… With eAccelerator the result is quite impressive: users say the server speed is now 10000% higher (no joke!) So thank you all and keep up the good work!!! Server: eAccelerator 0.9.5 beta 1 Apache/2.0.55 (Debian) mod_python/3.1.3 Python/2.3.5 PHP/4.4.2-1 mod_ssl/2.0.55 OpenSSL/0.9.8a mod_perl/2.0.2
http://www.mafia-inc.de/ (2005/05/24) The Mafia-Incorporated is a succesfull Browser game with around 2.500.000 page impressions each day and over 5000 users. Server: PHP Version 4.3.10-9, eAccelerator 0.9.2a, Debian , Apache 2.0.53
http://www.mondespersistants.com/ (2005/01/07) An other game oriented french website with 6 000 000 pageloads monthly. http://guildes.mondespersistants.com is a full PHP5 oo development. Theses websites are running under freebsd / apache 1.3 / php 5.0.3 / eaccelerator 0.9.2
http://www.moviemaze.de/ (2005/12/09) Markus Ostertag - Movie Maze is a large german online-magazine with trailer, wallpaper, reviews, news and much more. Currently we use three servers (Suse & Debian with Apache 2, PHP4) with eAccelerator and provide more than 3TB data to ~1 Mio. users each month.
http://www.rtvslo.si (2005/01/04) The Slovenian National RTV Station and its news/misc portal with forums. Over 3500 users and more than 37000 forum messages in a year. Two round-robin servers for the masses, and an administrator server. 6 000 000 pageloads monthly.
http://www.shroomery.org/ (2006/03/28) A site about mushrooms and mycology, serving 20,000,000 pages per month. Web and database server are identical dual 64-bit Xeons with 4GB and SCSI RAID5 running Gentoo. eAccelerator help keep our page generation time under .1 second!
http://www.sourceforge.net/ (2005/04/25) SourceForge.net is the world’s largest Open Source software development web site, hosting more than 100,000 projects and over 1,000,000 registered users with a centralized resource for managing projects, issues, communications, and code. SourceForge.net has the largest repository of Open Source code and applications available on the Internet, and hosts more Open Source development products than any other site or network worldwide. SourceForge.net provides a wide variety of services to projects we host, and to the Open Source community. eAccelerator is used on the webserver cluster for their frontpage.
Companies offering hosting with eAccelerator enabled ?
http://lylix.net/ (2006/04/29) Offering webhosting w/ Apache/2.0.55, PHP 5.0.5, and eAccelerator 0.9.5 beta1 on Gentoo Linux servers. Also a provider of quality Virtual Private Server (VPS) hosting, including 32 and 64-bit platforms. Most VPS images have a pre-installed LAMP environment w/ eAccelerator installed and configured.
http://www.ulyssis.org A student organisation which provides shell and internet services for students at very cheap prices.
本文为Michael原创和整理,转载请保留出处:http://www.toplee.com/blog/?p=100
?phpbr>?phpbr>?phpbr>?php>?php>
安装很简单,是预编译文件,作为php的扩展安装,二进制包在这里,针对PHP版本不同是不同的文件。
下载,复制到php的扩展目录,然后给php.ini扩展后大约在php_gzip.dll后面加上
extension=”eaccelerator.dll” ;扩展文件名
eaccelerator.shm_size=”800″ ;分配的内存以及磁盘限额单位是M .
eaccelerator.cache_dir=”C:\temp” ;临时文件目录,确保user权限
eaccelerator.enable=”1″ ;开启缓存服务不?
eaccelerator.optimizer=”1″ ;开启优化不?
eaccelerator.check_mtime=”1″ ;检测文件更新不?
eaccelerator.debug=”0″ ;调试不?
eaccelerator.filter=”*.php” ;文件类型,空格分割支持*和!语法
eaccelerator.shm_max=”." ;缓存文件大小限制0不限制,如1k,10M,20480
eaccelerator.shm_ttl=”7200″
eaccelerator.shm_prune_period=”3600″
eaccelerator.shm_only=”0″
eaccelerator.compress=”1″ 压缩不?
eaccelerator.compress_level=”9″
eaccelerator.keys = “shm”
eaccelerator.sessions = “shm”
eaccelerator.content = “shm”
eaccelerator.admin.name=”name”
eaccelerator.admin.password=”198554″;WEB控密码,md5 hash,然后把这行和上行的明文写在下行的脚本理
eaccelerator.allowed_admin_path = “D:\www\xxx.com\ec.php”;WEB控脚本
shm那里,有下面几个可选的,shm_and_disk,内存和硬盘存储数据,shm内存优先超过eaccelerator.shm_size限制后使用硬盘,shm_only仅仅内存,disk_only仅仅硬盘,none不缓存
程序中嵌套的说明在这里
本来想自己写缓存到硬盘的东西的,这样也不错了,mysql负载感觉是下降了。
没完全搞懂,有时间仔细看下手册,然后更新或者补充
这个东西只是加速软件,缓存的是脚本代码,而非输出文本,我想要的东西叫squid,NT下也可以阿装,还没细致看,花了一个多小时优化mysql数据库,总算好了。出问题的数据库是dedecms0.8的表,自己写的前台,偷懒终究出问题,然后用Website press tool 测试,带宽跑完,CPU依旧很低,应该是没什么问题了。真正有时间,还是静态化好了。
效果比如:
eAccelerator
eAccelerator support enabled
Version 0.9.5.1 Q
Caching Enabled true
Optimizer Enabled true
Memory Size 838,860,760 Bytes
Memory Available 835,595,488 Bytes
Memory Allocated 3,265,272 Bytes
Cached Scripts 70
Removed Scripts 0
Cached Keys 0
eAccelerator 是在 mmcache PHP 加速器/编码器的基础上更新开发的产品。下载地址:http://www.arnot.info/eaccelerator/ 它利用预先编译的缓存来提高PHP脚本的表现, 这样几乎可以完全避免超负荷编译带来的系统性能降低。 eAccelerator 的加速效果是非常明显的。昨天在一台繁忙的论坛服务器(使用vbb 2.x)测试了,速度有明显的提升,系统负荷大幅度降低。eAccelerator在Debian下安装很简单:
eaccelerator.shm_size="64"
eaccelerator.cache_dir="d:\websvr\php5\tmp"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter = ""
eaccelerator.shm_max = "0"
eaccelerator.shm_ttl = "7200"
eaccelerator.shm_only = "1"
eaccelerator.compress = "1"
eaccelerator.compress_level = "3"
eaccelerator.keys = "shm_only"
eaccelerator.sessions = "shm_only"
eaccelerator.content = "shm_only"
在这里您可以找到设置 php.ini 的相关细节.
zend_extension="/usr/lib/php4/eaccelerator.so"
;zend_extension_ts="/usr/lib/php4/eaccelerator.so"
;extension="eaccelerator.dll"
;zend_extension_ts="c:php4eaccelerator.dll"
;zend_extension="c:php4eaccelerator.dll"
您必须取消一条注释 (而且同时只能是一条被取消) 以便使用下面的描述来装载 eAccelerator 的扩展.
eAccelerator 兼容于 Zend Optimizer’s loader. Zend Optimizer 在 eAccelerator 的安装结束进行后必须在 php.ini 中配置. 如果您不使用用脚本来编码的 Zend Encoder ,那么我们不推荐您安装成 Zend Optimizer 加上 eAccelerator 这种模式.
--------------------------------------------------------------------------------
eaccelerator.shm_size = "64"
eAccelerator 可以使用的共享内存的数量 (以兆为单位) . "0" 是指操作系统的默认值. 默认值是 "0".
--------------------------------------------------------------------------------
eaccelerator.cache_dir = "/tmp/eaccelerator"
这个目录是给磁盘缓存使用. eAccelerator 在这里储存预先编译好的代码, 进程数据, 内容以及用户的自定义内容. 同样的数据也能被储存在共享内存中 (这样可以提高访问速度). 默认的设置是 "/tmp/eaccelerator".
--------------------------------------------------------------------------------
eaccelerator.enable = "1"
打开或者关闭 eAccelerator. "1" 是指打开, "0" 是指关闭. 默认值是 "1".
--------------------------------------------------------------------------------
eaccelerator.optimizer = "1"
打开或者关闭内置的 peephole optimizer,它可以提高代码的执行速度. "1" 是指打开, "0" 是指关闭. 默认值是 "1".
--------------------------------------------------------------------------------
eaccelerator.debug = "0"
打开或者关闭调试记录. "1" 是指打开, "0" 是指关闭. 默认值是 "0".
--------------------------------------------------------------------------------
eaccelerator.check_mtime = "1"
打开或者关闭 PHP 的文件修改检查. "1" 是指打开, "0" 是指关闭. 如果您在修改以后重新编译 PHP 的文件,那么您应当设置为 "1". 默认值是 "1".
--------------------------------------------------------------------------------
eaccelerator.filter = ""
决定哪些 PHP 文件应该被缓存. 您可以指定一个范围 (比如 "*.php *.phtml"),这样被指定的文件就会被缓存或者被排出在外. 如果使用字符 "!" 来指定这个范围, 符合这个范围的文件就被排出在外. 默认值是 "" ,意思是说 - 所有的 PHP 脚本都会被缓存.
--------------------------------------------------------------------------------
eaccelerator.shm_max = "0"
利用 "eaccelerator_put()" 这个功能选项来关闭在共享内存中加载大量数据. 它指出最大的被允许的大小,以字节为单位 (10240, 10K, 1M). 使用 "0" 来关闭这个限制. 默认值是 "0".
--------------------------------------------------------------------------------
eaccelerator.shm_ttl = "0"
当 eAccelerator 尝试从共享内存中获得数据来创建新的脚本缓存但失败以后,它从共享内存中删除所有的至少在 "shm_ttl" 秒以前没有被访问的脚本。默认值是 "0" ,意思是说 - 不要从共享内存中删除任何文件.
--------------------------------------------------------------------------------
eaccelerator.shm_prune_period = "0"
当 eAccelerator 尝试从共享内存中获得数据来创建新的脚本缓存但失败以后,它尝试删除旧的脚本,前提是在这之前的这个尝试在超过 "shm_prune_period" 秒之前被执行. 默认值是 "0" ,意思是说 - 不要尝试从共享内存中删除任何文件.
--------------------------------------------------------------------------------
eaccelerator.shm_only = "0"
打开或者关闭在磁盘上缓存编译过的脚本. 这个参数对会话数据和内容缓存没有效果. 默认值是 "0" ,意思是说 - 使用磁盘和共享内存来缓存。
--------------------------------------------------------------------------------
eaccelerator.compress = "1"
打开或者关闭缓存后的内容压缩. 默认值是 "1" ,意思是说打开压缩.
--------------------------------------------------------------------------------
eaccelerator.compress_level = "9"
内容缓存后被压缩的程度. 默认值是 "9" ,意思是说使用最大程度的压缩率。
--------------------------------------------------------------------------------
eaccelerator.keys = "shm_and_disk"
eaccelerator.sessions = "shm_and_disk"
eaccelerator.content = "shm_and_disk"
决定哪些 keys, 会话数据和内容被缓存. 可能的值是:
"shm_and_disk", 在共享内存中和磁盘上缓存数据 (默认值)
"shm", 在共享内存中或者磁盘上缓存数据,如果共享内存被使用的尺寸已经超过 "eaccelerator.shm_max" 所定义的范围。
"shm_only", 在共享内存中缓存数据
"disk_only", 在磁盘上缓存数据
"none", 不缓存任何数据
-------------------------------------------------------------------------------
eaccelerator.admin.name="yourusername"
eaccelerator.admin.password="yourpassword"
您可以使用 eaccelerator.php 通过网页的页面来管理 eAccelerator. 您应该把这个文件放在您的网站上. 为了安全,推荐您不要通过您本地的IP地址来访问这个脚本。
创建 eAccelerator 的密码
php -q eaccelerator_password.php
改变网页页面方式访问 (eaccelerator.php)这个文件的访问密码
Enter admin name: admin
New admin password: eaccelerator
Retype new admin password: eaccelerator
但是现在已经改掉了,现在使用的是control.php 作为新的控制台。
需要这三个文件。默认的用户名和密码是admin eAccelerator 。
PHP_Highlight.php control.php dasm.php Requirements
------------
apache >= 1.3, mod_php >= 4.1, autoconf, automake, libtool, m4
Compatibility
-------------
eAccelerator has been reported working with php4 and php5, php 5.1 support hasn't been integrated yet. It is being used on Linux, FreeBSD, MacOS X, Solaris and Windows with apache 1.3 and 2, lighttpd and IIS.
Quick install
-------------
You can find more information about installation on eAccelerator website.
http://eaccelerator.sourceforge.net/
Note(1): for Microsoft Windows installation, please refer to README.win32 file.
Step 1. Compiling eAccelerator
export PHP_PREFIX="/usr"
$PHP_PREFIX/bin/phpize
./configure \
--enable-eaccelerator=shared \
--with-php-config=$PHP_PREFIX/bin/php-config
make
You must specify the real prefix where PHP is installed in the "export"
command. It may be "/usr" "/usr/local", or something else.
Step 2. Installing eAccelerator
make install
Step 3. Configuring eAccelerator
eAccelerator can be installed both as Zend or PHP extension.
For eaccelerator > 0.9.1, if you have /etc/php.d directory, you should copy eaccelerator.ini inside and modify default value if you need.
If not, you need to edit your php.ini file (usually /etc/php.ini).
To install as Zend extension:
zend_extension="/usr/lib/php4/eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
If you use thread safe build of PHP you must use "zend_extension_ts" instead
of "zend_extension".
To install as PHP extension:
extension="eaccelerator.so"
eaccelerator.shm_size="16"
eaccelerator.cache_dir="/tmp/eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0"
eaccelerator.shm_prune_period="0"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
Step 4. Creating cache directory
mkdir /tmp/eaccelerator
chmod 0777 /tmp/eaccelerator
Configuration Options
---------------------
eaccelerator.shm_size
The amount of shared memory (in megabytes) that eAccelerator will use.
"0" means OS default. Default value is "0".
eaccelerator.cache_dir
The directory that is used for disk cache. eAccelerator stores precompiled code, session data, content and user entries here. The same data can be stored in shared memory also (for more quick access). Default value is "/tmp/eaccelerator".
eaccelerator.enable
Enables or disables eAccelerator. Should be "1" for enabling or "0" for disabling. Default value is "1".
eaccelerator.optimizer
Enables or disables internal peephole optimizer which may speed up code execution. Should be "1" for enabling or "0" for disabling. Default value is "1".
eaccelerator.debug
Enables or disables debug logging. Should be "1" for enabling or "0" for disabling. Default value is "0".
eaccelerator.check_mtime
Enables or disables PHP file modification checking . Should be "1" for enabling or "0" for disabling. You should set it to "1" if you want to recompile PHP files after modification. Default value is "1".
eaccelerator.filter
Determine which PHP files must be cached. You may specify the number of patterns (for example "*.php *.phtml") which specifies to cache or not to cache. If pattern starts with the character "!", it means to ignore files which are matched by the following pattern. Default value is "" that means all PHP scripts will be cached.
eaccelerator.shm_max
Disables putting large values into shared memory by " eaccelerator_put() " function. It indicates the largest allowed size in bytes (10240, 10K, 1M).
The "0" disables the limit. Default value is "0".
eaccelerator.shm_ttl
When eaccelerator fails to get shared memory for new script it removes all scripts which were not accessed at last "shm_ttl" seconds from shared memory. Default value is "0" that means - don't remove any files from shared memory.
eaccelerator.shm_prune_period
When eaccelerator fails to get shared memory for new script it tryes to remove old script if the previous try was made more then "shm_prune_period" seconds ago. Default value is "0" that means - don't try to remove any files from shared memory.
eaccelerator.shm_only
Enables or disables caching of compiled scripts on disk. It has no effect, on session data and content caching. Default value is "0" that means - use disk and shared memory for caching.
eaccelerator.compress
Enables or disables cached content compression. Default value is "1" that means enable compression.
eaccelerator.compress_level
Compression level used for content caching. Default value is "9" which is the maximum value
eaccelerator.name_space
A string that's prepended to all keys. This allows two applications that use the same key names to run on the same host by setting this in .htaccess or in the main configuration file for the whole webserver.
eaccelerator.keys
eaccelerator.sessions
eaccelerator.content
Determine where keys, session data and content will be cached. The possible
values are:
"shm_and_disk" - cache data in shared memory and on disk (default value)
"shm" - cache data in shared memory or on disk if shared memory
is full or data size greater then "eaccelerator.shm_max"
"shm_only" - cache data in shared memory
"disk_only" - cache data on disk
"none" - don't cache data
eaccelerator.allowed_admin_path
The script paths that are allowed to get admin information and do admin controls
Control panel and disassembler
------------------------------
If you want to use the control-panel you need to compile eAccelerator with --with-eaccelerator-info which is the default value.
You need to copy the control.php file to your webroot and set the path to it in the php.ini or eaccelerator.ini in the eaccelerator.allowed_admin_path directive. If you don't do this you wont be able to see much information and can't control eAccelerator.
You can set the username and password needed to access the control-panel in the control.php file.
When you compile eAccelerator with --with-eaccelerator-disassembler you need to place the dasm.php and PHP_Highlight.php file also in the same directory as the control.php file. The disassembler requires PHP to be compiled with tokenizer support (--enable-tokenizer).
You can set the username and password needed to access the disassembler at the top of dasm.php.
eAccelerator API
----------------
API documentation can be found on this website: http://bart.eaccelerator.net/doc/phpdoc/
Contact us
----------
You can contact us with questions, patches or bugs, by sending an email to Bart Vanbrabant
zend_extension = /usr/local/lib/php/extensions/non-debug-non-zts-xxx/xcache.so
;; Windows 系统例子:
zend_extension_ts = c:/php/extensions/php_xcache.dll
;; 或者您也可把 XCache 安装成 extension, 注意确保您的 extension_dir 设置正确, 并
把 xcache.so 或者 php_xcache.dll 放到该目录里面
; extension = xcache.so
;; 或者 Win32 系统:
; extension = php_xcache.dll
一.准备工作
windows 2003,自己买吧...
安装IIS 6.0:
安装系统后在"控制面板"->"添加或删除程序"->"添加/删除Windows组件"->双击"应用程序服务器"->然后选中"Internet信息服务(IIS)"->确定->安装完毕...
下载PHP:http://cn2.php.net/get/php-5.2.5-Win32.zip/from/this/mirror
下载MySQL:http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.51a-win32.zip/from/pick#mirrors
根据自己的速度,随便点击下面一个国家后面的HTTP/FTP之类的链接进行下载...
下载Zend Optimizer:http://www.zend.com/en/products/guard/downloads
自行选择版本下载,我下的是3.3.3版...
下载Xcache:http://xcache.lighttpd.net/wiki/Release-1.2.2
很多人可能不知道Xcache是什么,下面作个简单介绍:
XCache是一种新的php缓存器,经过本人测试,在Windows下效果比同类软件强很多.
实际测试效果如下(非科学方法):
原网页平均执行时间: 0.13 秒
加速后网页平均执行时间: 0.03秒
原CPU占用率: 15% - 60%
加速后CPU占用率: 3% - 30%
由上数据可以看出,使用这个加速器可以很大程度的降低CPU占用(但会造成更多的内存占用),并使网页执行时间缩短.
由于其他同类软件对Windows的支持不够好,所以选用XCache是Windows主机的不二之选.
XCache是一种新的php缓存器,经过本人测试,在Windows下效果比同类软件强很多。
实际测试效果如下(非科学方法):
原网页平均执行时间: 0.13 秒
加速后网页平均执行时间: 0.03秒
原CPU占用率: 15% - 60%
加速后CPU占用率: 3% - 30%
由上数据可以看出,使用这个加速器可以很大程度的降低CPU占用(但会造成更多的内存占用),并使网页执行时间缩短。
由于其他同类软件对Windows的支持不够好,所以选用XCache。
网上很多说明都不够详细,所以给大家写一篇。
安装与配置
首先下载XCache,网址为:
下载地址:http://xcache.lighttpd.net/wiki/Release-1.2.2
需要下载跟你php版本匹配的binaries for Windows。
下载后解压,把php_xcache.dll放在php.ini中指定extension_dir中。
下面开始配置,打开php.ini。
401.1 未经授权:访问由于凭据无效被拒绝。
401.2 未经授权: 访问由于服务器配置倾向使用替代身份验证方法而被拒绝。
401.3 未经授权:访问由于 ACL 对所请求资源的设置被拒绝。
401.4 未经授权:Web 服务器上安装的筛选器授权失败。
401.5 未经授权:ISAPI/CGI 应用程序授权失败。
401.7 未经授权:由于 Web 服务器上的 URL 授权策略而拒绝访问。
403 禁止访问:访问被拒绝。
1. 你不能通过为一个受到损害的系统打补丁来保持其健康;补丁只能清除漏洞。而一旦一个黑客进入了你的系统,你应当假定他已经保证有其它的方法可以使其重新进入。
2. 你不能通过移除后门来净化你受到损害的系统。你千万不要保证已经找到了攻击者可以进入的所有后门。
3. 你不能通过使用一些漏洞清除程序来为系统“净身”。让我们假设你的系统受到了冲击波的攻击。许多厂商(国内的、国际的都有)都发布了其漏洞清除程序。在清除工具运行之后,你能相信一个曾受冲击波攻击的系统吗?笔者不能。因为如果系统易受到冲击波的攻击,那么它也容遭受其它形式的攻击。你能保证其它的某种攻击不会针对你的系统吗?
4. 你不能通过使用一个病毒扫描程序来保障曾受到攻击的系统是安全的。一个完全受到损害的系统是不可信任的,它不会告诉你真相。甚至病毒扫描程序在某种水平上还要依赖于系统对其“真诚相见”,也就是说系统会向病毒扫描程序撒谎。如果要问一个特定的文件是否存在,攻击者可能只需要一个工具就可以告诉你一些虚假信息。.如果你能保证损害系统的唯一因素是一个特定的病毒或蠕虫,并且你知道这个病毒或蠕虫没有与之相关的后门,而且由这个恶意代码利用的漏洞不能从远程利用,那么可以使用一个病毒扫描程序来清洁你的系统。例如,多数电子邮件蠕虫依赖于一个用户打开一个附件。在这种特定的情况下,系统上的唯一感染源就是包含蠕虫的邮件附件。不过,如果这个被蠕虫所利用的漏洞能够在用户不操作的情况下被远程控制,而且你不能保证蠕虫是利用此漏洞的唯一因素,那么其它的某种恶意代码利用同一个漏洞的可能性是完全可能的。
5. 在现有的系统上重新安装操作系统也不能保证系统的安全性。攻击者仍会使用安排好的一些工具来欺骗安装程序。如果是这种情况,安装程序可能并没有真正清除受到感染或损害的文件。此外,攻击者还有可能在非操作系统部件中安置后门。
6. 你不能相信通过复制、粘贴等手段来自受损系统的任何数据。一旦一个攻击者进入了一个系统,其上的所有数据都可能被篡改。将一个受损系统的数据复制到一个干净的系统上,其结果是什么呢?最好的情况是,你将得到潜在地不可信任的数据。最糟的情况是,你可能复制了一个隐藏在数据中的后门。你说可怕不可怕?
7. 你不能相信受损系统上的事件记录。一旦一个攻击者完全进入了一个系统,他修改事件记录来掩盖其攻击的足迹是相当简单的事情。如果你依赖于事件记录来告诉你攻击者对你的系统做了什么操作,那么你有可能正中其下怀,因为你读的可能是黑客们需要你读的东西。
8. 你还可能无法相信最新的备份。你能指出最初的攻击是什么时候发生的吗?前面说过,事件记录是不可相信的。如果没有这些知识,你最新的备份就毫无用处。也许可以这样说,你做的只是一个包括目前系统上所有漏洞的备份,你能相信任何备份吗?在你上网炒股时尤其要注意这一点,因为你无法完全确定用以恢复的系统没有包含“网银大盗”这种间谍程序。
9. 也许我们可以这样说,保持系统健康的唯一正确方法是自己破坏原有的系统,并重新构建它。也许可以这样说,要想创造一个新世界,首先要打破一个旧世界。如果你拥有一个受到彻底损坏的系统,你可以实施的唯一安全措施是重新构建、安装系统。
还有其它什么选择吗?我们的回答是有的,那就是一开始就要防止系统受到攻击。关于这方面有许多文章,你可以上网上找到许多资料,例如,通过一般用户上网查找资料,正确设置浏览器防止自动下载,及时安装下载补丁(不过,你怎么知道什么时候算是“及时”?你能为所使用的所有应用程序和工具及时安装补丁吗?),修改超级用户密码,安装防火墙,等等,在此笔者就不一一列举了。但我们要说的是,没有绝对安全的网络和系统!
[此文来源于互联网,牛C网只负责收集整理]
花一分钟想象一下一个厉害的黑客正在攻击公司的基础设施。公司基础设施的信息有什么价值?你真的知道有多少敏感信息是向公众公开的或是略施小计就可以获得的?任何一个厉害的黑客攻击的第一步就是对目标的侦察。让我们来看一下几种常见的技术,还有如何防止他们。
经常有很多令你吃惊的大量的关于你们公司的敏感信息在网络中出现,等待着一些人偶然发现。你曾经为了你的域名搜索过IT论坛吗?试试看吧!技术员工将经常在公共论坛上粘贴问题或者答案,提到在他们公司运行中的特殊设备,他们甚至用到了他们的工作电子邮件地址。哇!很明显,他们没想到黑客会喜欢不用接触到你的网络就可以找出防火墙的类型或者你所属的服务器。为了避免这种情况发生,你应该加强执行一个政策就是要求你的使用者们不要用他们的工作电子邮件地址在公共论坛上注册任何信息,公司的名字也应该被禁止使用。他们仍然可以得到问题的答案,但是你的基础设施的细节就不会被全世界看到。
另一个黑客寻找你的技术员工信息的地方是IP地址的在线数据库和网站注册。实际上有四个数据库,每个包含一种类型的世界上不同部分的信息。查看在http://www.networksolutions.com或者http://www.ARIN.net上的Whois部分,看是否能看到你公司的域名列表,名称,电子邮件,或你技术员工的电话号码。理想地,你应该提供这些领域中的普通信息,以防止黑客利用这些员工的身份,来迫使你的用户泄漏他们的密码或其他敏感信息。
一个人的垃圾是另一个人的珍宝!在垃圾桶中搜寻是一种古老的,龌龊的但是仍然富有成效的信息聚集技术,在这种技术中,攻击者仔细查看你的垃圾,寻找社会保障号码,电话号码,使用者ID,IP地址和密码。一个政策应该被加强,就是要求员工销毁含有任何可能被错误使用的信息。如果你真的认为这不必要,那么我鼓励你去查一下在靠近你的网络打印机旁边的垃圾桶的内容,特别在IT领域中。你会把发现物交给一个黑客吗?
[此文来源于互联网,牛C网只负责收集整理]







