[翻译]What is Linux? -- 什么是Linux (Linux/Unix)
发布于 2008-04-15 18:18 阅读:58,605 评论:0 标签: Linux 翻译

  原文:What is Linux?   同时发布:译言

  也许你已经听过很多关于Linux的事情,而且决定体验一下它。如果你是个Linux新手,或者你对电脑都是陌生的,那在最开始的的可能会有点迷惑。但是不要当心这个,事实上这是相当简单的事情。放松一下继续阅读下去吧,我们会为你解释所有的问题。

  在本文中,“Linux”这个单词描述的是一组东西。精确地讲,“Linux”代表着一个操作系统内核 -- 也就是说,它是一个操作系统的底层,所有的艰苦的工作,如与计算机的硬件对话,管理内存和驱动程序,都是由它完成。除非你是一个计算机高级用户,或者你要深入进去解决一些硬件或软件问题,否则你将永远不会接触到它,甚至不需要考虑到它的存在。

  尽管它对于计算机系统来说是非常重要的,但是对用户来说是不会直接接触到它的。相反的是,你会工作在一个被称为“用户平台”的程序中 -- 如此称呼是因为用户是直接工作在这些程序之上的。当一个发行商或项目组把Linux内核和一些对用户有用的用户平台上的程序捆绑在一起,我们将之称为Linux分发版,或简称为“Linux” -- 因为Linux在其中处于核心地位,而且每次称作“Linux分发版”会使人喘气太困难了。一般来说,当有人和你说“我使用Linux”,或“你用过Linux吗?”,他们不仅是在说内核,他们说的是整个Linux分发版。

什么是分发版,哪一个是我应该选择的?

  谈及Linux分发版,你可能会奇怪的觉得究竟什么是分发版。这个是相当简单的。在我们上面的讨论中,我们知道这个Linux内核本身对终端用户是很难有用的。你不能用它玩俄罗斯方块、写文档、开通网页服务,或者发送邮件 -- 如果你不能做这些事情,它怎么能称之为计算机呢?

  所以,很多的发行商和项目组们决定把Linux内核和一些有用的软件整合在一起,于是你就可以很有亲切感的做很多事情了。同时,他们也提供了安装步骤,这样你就可以在电脑上安装Linux了和管理应用程序:如添加和管理驱动、管理用户、无需在命令行环境下使用文本编辑器和指令工作。当你把Linux内核和有用的软件、安装程序、软件管理工具整合在一起,你就拥有一个Linux分发版了。

  下一个问题是,哪一个分发版 -- 或发行套件 -- 是你该选择的?不幸的是,这个问题不像分发版那样好解释。基于很多的因素,我们无法告诉你该选择哪个分发版,这完全取决于你的个人经历,和你想用来做什么。

  一些发行套件,像Rad Hat企业版SUSE企业版主要是为一些使用Linux作服务器的企业使用的。一些如Fedora CoreUbuntuopenSUSE的发行套件有着不同的外观,它们适合使用桌面或用作服务器的用户。

  如果你问20个Linux的使用者他们该选择那个发行套件,你可能会得到很多不同的答案 -- 而且他们都是对的,至少对他们自己而言。

  非常好的是大多是Linux分发版都是免费的,你可以下载每一种,然后试试看哪一种能满足你的需要。可以看看我们的套件中心来得到最流行的发行套件和更多信息。

它们都是免费的吗?

  这个消息是真的吗?微软、苹果以及其他的公司都对他们的软件进行收费,你能够免费下载与Windows或Mac  OS  X旗鼓相当的软件,这听起来有点奇怪。这是怎么回事呢?

  简而言之,一些人认为这些软件应该自由和开源的分发,这样软件就可以自由的分享了 -- 而且你甚至可以修改它!这个行动已经存在很长时间了。GNU项目于1984年由Richard Stallman创建,这个时间早于微软公司发行他的第一版Windows操作系统,同年,苹果公司发布他第一版经典的Mac OS操作系统。

  这个项目一直在聚集着力量,在1991年的时候Linus Torvalds发布了Linux的第一个公开的发行版。Linus Torvald也把Bash Shell和GCC加进了Linux,以使它更有使用价值。最终Torvalds决定采用GPL作为内核的许可协议。

  GPL,是由GNU组织发展起来的,他允许你根据GPL把软件分享给你任何你愿意的人。你可以依据GPL修改这些软件,并分发出新的版本。一旦你在这些许可协议下分享了这些软件,你就接受了这个协议。

GNU/Linux包含了什么?

  一些人乐意把Linux称作GNU/Linxu,因为他们想用这种方式来强调GNU组织对Linux分发版的贡献。Linxu内核在任何Linux分发版都扮演着巨大作用,而这离不开GNU组织所贡献出的软件。例如,如何没有GNU Compiler Collection (GCC),你如何编译内核或者其它运行在Linux下的程序?大多数Linux分发版把GNU Bash作为默认的Shell,GNOME、GTK+使用着GNU glib,还有其它很多的程序在Linux全天候运行着。

  没有必要列出所有的由GNU组织开发运行在Linux的软件,这实在是太多了。没有GNU,我们将错过许多精彩的软件。

  从Linux的分发版中,GNU组织获得了很大影响力的认可。但是,GNU组织并不是唯一的主要贡献者。值得记载的是,Linux分发版所的软件来自许多其他的组织--比如GNOME、KDE、OpenOffice.org、Mozilla基金会等等。

  Linux还是GNU/Linux,这就取决于你了。

自由软件和开源软件的区别

  自由软件和开源软件是有区别的。需要注意的是,所有的自由软件都是开源软件 -- 因为它符合Open Source Initiative (OSI)对开源的定义,其简称为OSI

  然而,并不是所有的开源软件符合GNU组织或Debian组织自由软件的定义。那他们有什么区别呢?基本上,他们存在哲学上的差异。在GNU组织的世界中,自由软件事关自由,而不是价钱。

  而另一方面,开源软件最初起源于它的开发模式。它的开源软件模式 -- 分布式的开发,透明的开发过程,可修改的代码 -- 比私有软件开发模式要好点。因此,开源许可协议可能在某些方面对用户有所限制,而自由软件却不一定会。

  并非所有运行在Linux的软件都是自由或者免费的。很多公司为Linux开发了私有性的软件,你可以付出一点钱来得到它。例如,Oracle有产品运行在Linux上,但他们并没有开放它 -- 他们出售运行在Linux上的Oracle数据库和其它软件来获取利益。

  尽管GPL和其他许可协议要求其下的衍生产品执行相同的许可协议,但他们没有要求非其衍生的产品执行相同的许可协议,所以很多公司可以出售运行在Linux上的软件,这不会破坏任何规定和许可协议。

  事实上,的确有一些公司在出售Linux并做售后服务,而且做得也很不错。红帽子分发版、红帽子企业版,它们包含了自由和开源软件(FOSS),他们从中获取利益已经一段时间了。他们并不是依靠出售许可协议而获取利益,而是在对分发版的技术支持上得到收益,因为很多公司愿意在遇到问题或需要新的功能时付出酬劳。

我可以在Linux下运行Windows程序吗?

  如果你曾经是一个Windows用户,当然大多数人都是这样的,你可能在使用Linux时也能支持你所需要的Windows程序。原本上,Windows程序是不能运行在Linux上的,但是你在Linux上找到替代方法,或者你的确需要的话,你可以使用一些Linux插件来帮助你。

  Wine就是这样的一个选择。Wine是一个开源的软件,它可以让Windows程序运行在Linux或Unix操作系统上。它对Windows程序是兼容的,所以你可以不改变程序的前提下在Linux运行它。另一个选择是CodeWeavers CrossOver,它是基于Wine的,但并不是完全开源的。它拥有一些Wine不具备的功能,使得其在Linux下更加容易安装和运行Windows程序。

  还有一个选择是虚拟机。虚拟机和VMware、VMware工作平台、ParallelsQemu一样,可以让你在Linux下像在处于Windows环境中一样运行程序 -- 所以你可以在Linux下无需修改的运行几乎所有的Windows程序,这就好像在Windows下运行一样。(一些要求3D支持的应用可能在虚拟机无法运行,因为虚拟机不支持3D图形环境)。

  在不远的未来,你可能更愿意使用Linux下程序来取代你在Windows下的程序了。下一章中,我们将讨论如何找到Linux下的程序,并安装它们。

展开全文  
收起全文  
[翻译]What is Linux? -- Linux从这里开始 (Linux/Unix)
发布于 2008-04-03 15:35 阅读:42,569 评论:0 标签: Linux start 翻译

      想从现在开始,每周翻译一篇英语文章。请广大网友监督!

  原文: Linux starts here  同时发布:译言

开始了解Linux

  Linux(发音:LIH-nuks)是一个类似Windows或Mac的计算机操作系统。一般认为Linux是由芬兰的程序员Linus (发音:LEE-nus) Torvalds于1991年在遍及全球的开发者帮助下起源的。Linux类似早期的操作系统Unix,但与Unix不同的是,Linux是一种自由和开源的软件 -- 也就是说,你不仅可以下载并在你的电脑上运行,而且还可以下载它的源代码。你可以修改或扩展这些源代码以适应你的需求。

  Linux广泛运行在多种硬件平台上,从大型的主机到个人电脑,甚至手机上。Linux遵循自由软件基金会GNU项目GNU General Public License第二版规定,它允许用户改变和分发这个操作系统。

  你可以认为Linux由两部分组成 -- 一个被称为内核,它是连接硬件和系统软件系统的基本接口。二是在内核之上运行的各种程序,比如图形用户界面(GUI)和应用程序。

  没有专门的公司销售Linux。因为它是开源的软件,任何人都可以把一些程序和应用与Linux打包为一个整体,并分发它。这种不同的“味道”的Linux被称为分发版。你可以从我们的分发版页面上得到大部分流行的分发版的资料。分发版的一些丰富的资源可以在DistroWatch.com上找到。

  许多Linux的分发版被设计成在你电脑的硬盘上安装,它可以作为一个唯一的操作系统,也可以和其它的操作系统共同存在,这样你可以在每次电脑启动时选择使用哪个操作系统。还有一些分发版可以作为Live CD在你的移动媒体上引导运行,典型的如CD,当然也有Live DVD分发版,甚至有一些分发版可以从软盘或者USB上引导启动。Live类型的分发版是非常有用的,因为这样可以让你在不影响目前的硬盘上的东西的基础上运行不同的操作系统。

  如果你是一个对Linux完全不了解的Windows用户,请丢弃那些令人听起来对Linux沮丧的声音。为了你们,我们写了另一篇文章,可以让你在不改变你的Windows系统情况下测试Linux,也可以让你保留Windows程序和文件情况下安装Linux,你也可以根据你的需要选择适合你的分发版。

Linux桌面

  能让Linux对你电脑有用的一方面是它的图形用户界面(GUI)。这个GUI使用可点击的图标、由屏幕面板、滚动条组成的小窗口让Linux秀色可餐(“look and feel”),而且用户使用的菜单和图标等是可以设置和改变的。这种可视可点击的环境,不依赖于命令行的可视化布局,让操作系统更加的直观可用。如果没有GUI,Linux(或其它任何操作系统)会要求用户依次输入各种命令,也就是命令行模式(CLI)。

  当大多数操作系统没有提供能让你选择你想要的用户界面的功能时,Linux却给你很多的选择。这些用户界面中的大多数不仅仅是提供了图形界面 -- 它们提供了一个具有多种工具、应用程序、游戏和其他应用的桌面环境,这样可以让用户的电脑体验可以更丰富一点。Linux下最流行的两种桌面环境是KDE和GNOME。

  KDE是K桌面环境的代表。KDE可以运行任何Unix操作系统下,包括Linux。KDE所有的源代码是遵循GNU General Public License的,这也意味着任何人能得到和改变KDE以适应自己的应用。KDE集成在大多数的Linux分发版里,包括一些标准化的菜单、工具条、配色方案,同时提供了完整的帮助系统,网络工具、图形和多媒体应用,以及完整的办公系统解决方案和其他多种软件工具。KDE项目是被自由软件开发社区支持的,对于Linux使用者来说是无需任何费用的。

  GNOME (发音:guh-NOME),全称是GNU Network Object Model Environment,是Linux另一种非常普及的GUI或桌面环境。它也是遵循GNU General Public License,这也意味着对于任何Unix操作系统的用户,包括它的源代码都是自由可用的。GNOME集成在每一种Linux分发版上。这也是GNU项目的一部分,GNU项目开发了GNU操作系统,其中的一部分包含在所有的标准Linux分发版中。

  正如KDE,GNOME桌面环境包含的不止是工具条、图标和菜单。整套自由软件包里还包括帮助文件、网络工具以及GNOME  Office办公套件。其它在Linux下的GUI有:

  XPDE desktop environment
    “让Windows XP用户更容易的使用Linux”

  Xfce
    “多种*NIX系统下的轻量级桌面环境。它设计得很有效率,它能快速加载和执行程序,而不耗用太多系统资源”

  Enlightenment
    “高级的图形库、工具和环境”

  IceWM
    “IceWM的目标是快速、简单,不阻碍用户使用”

  Blackbox 
    “Blackbox是一种你所寻找的X窗口系统的快速、轻量级的窗口管理工具,而且它不依赖于那些繁琐的资源库”

  Window Maker 
    “Window Maker是一个X11窗口管理工具,最初是为了综合的支持GNUstep桌面环境”

  FluxBox 
    “建立在Blackbox基础上的快速、紧凑的窗口管理工具,它还具有更多的功能”

命令行

  这些所有的桌面环境的共同点之一是让用户可以使用Linux命令行;你没有必要使用鼠标去执行每一次操作。输入一条或几条命令可能会让一些操作更为快速和容易,这就好像是用户在20年前使用DOS操作计算机一样。

  每个桌面环境进入命令行模式的方式是不一样的。通常会提供一个窗口让你输入命令。在GNOME下,这个窗口叫GNOME终端;KDE下,叫做Konsole。

  我们为你准备了一篇文章:命令行基本介绍。一个更进一步学习的网站是LinuxCommand.org

桌面应用

  和所有操作系统一样,Linux也提供了广泛的桌面应用程序的支持。典型的程序包括电子邮件、办公软件、音乐盒电影播放、个人信息处理、诸如即时和聊天室的网络通讯,以及文件共享。

游戏

  Linux对游戏并不陌生。Linux的分发版总是包含着游戏;例如,GNOME游戏包里面包含了16款街机游戏和智力游戏;KDE游戏中心包含的游戏有街机、棋、牌、骰子、逻辑推理、谋略游戏,和一些小玩具。如果你的分发版没有你想要的游戏,你可以到一些商业性的网站,如Linux Game PublishingTux Games,或者你也可以直接到一些小的公司、独立出版人,个人爱好者手中直接购买。如果这个游戏是为微软的Windows操作系统或者家庭游戏而设计的,那么你可以通过模拟器得到帮助。有关Linux游戏的更多信息,你可以去下面的网站看看:Enjoying games with GNU/Linux

文章并未结束

  不久的将来,我们会提供更多的篇幅来介绍不同种类的桌面和服务方面的应用、编程工具、练习和支持方面的内容。我们非常欢迎你给我们来信提出一个Linux初学者应该知道的内容:editors@linux.com。如果你现在想提问题,可以到这个版面来:http://www.linux.com/forums/forum/1

展开全文  
收起全文  
PHP加速器eAccelerator文档翻译 (PHP心得)
发布于 2007-11-06 11:02 1 阅读:62,097 评论:1 标签: eAccelerator Linux PHP 翻译 文档

  前端时间用到这个,看了一下英文文档觉得还是看最原始的资料看到的东西最全。比如说eAccelerator自带了共享内存管理的程序,这个在我找到的中文资料里面就没有看到过。

  本文翻译的是:Release-0.9.5.2 ,官网是:http://www.eaccelerator.net/。原文附后,英文水平不高,如果您发现有不对的地方,还请告诉我!

--------------------------

PHP的eAccelerator
=====================

什么是eAccelerator?
----------------------
eAccelerator是一个的免费、开源的PHP模块,它能够为提供PHP加速、优化、加码、和动态内容缓存功能。它通过存储PH脚本编译后的状态而加快执行PHP脚本的速度,而不需要频繁的编译这个PHP脚本。而且它能优化PHP脚本,以提高执行PHP的速度。eAccelerator特色是减少了服务器负载、使PHP脚本加速1-10倍。

eAccelerator是TurckMMCache的一个分支
(请详见Dmitry Stogov维护的:http://sourceforge.net/project/turckmm-cache/

eAccelerator把编译好的PHP程序存储在共享内存里面,并直接在这里面执行程序。但在共享内存里面寻找编译好的PHP程序时,会在很短的时间内产生一些锁定,所以一个程序可以被多个进程同时执行。不适合放入共享内存的文件将被缓存到硬盘上。

eAccelerator包含了一个PHP加码器和解释器(loader????)。你可以使用encoder.php对你的程序加码,这样在分发程序的时候就可以不给出源码了。加码后的文件可以在任何机子上运行,只要它装有eAccelerator的PHP。加码后的代码不能被恢复,因为它是以编译完了的形式而存储的,而且存储时不包含源码。当然,程序中一些内部的东西可以使用反编译工具(different  reverse  engineering  tools)还原(例如:disassemblers, debuggers等等),但这并不是重要的。

eAccelerator可以和Zend Optimizer的加码器共存。但是在php.ini中Zend Optimizer必须在eAccelerator配置参数的后面。如果你不使用Zend Optimizer的加码器,我们不推荐同时安装Zend Optimizer

eAccelerator不能在CGI模式下运行,但是它能在一些web服务器下的Fast-CGI模式运行,比如:lighttpd。

下面是一些能提供相同作用的产品:
 - Zend Performance Suite (http://www.zend.com/)
 - Alternative PHP Cache (http://pecl.php.net/package/APC)

下载
--------
最新的eAccelerator版本能在下面的页面下载:
http://sourceforge.net/projects/eaccelerator/
版本控制的快照在:
http://snapshots.eaccelerator.net

要求:
--------
apache >= 1.3, mod_php >= 4.1, linux下工具:autoconf, automake, libtool, m4

兼容性:
--------
eAccelerator能与PHP4、PHP5很好的工作,对PHP5.1版本还没很好的兼容。它能使用在Linux, FreeBSD, MacOS X,
Solaris 和 Windows 下的 apache 1.3 and 2, lighttpd 和 IIS.

快速安装:
-------------

你可以在下面的网站上找到更多的安装信息:
http://eaccelerator.sourceforge.net/

注意:在Microsoft Windows下安装,请参考README.win32文件

第一步:编译eaccelerator

  export PHP_PREFIX="/usr"
 
  $PHP_PREFIX/bin/phpize
 
  ./configure \
  --enable-eaccelerator=shared \
  --with-php-config=$PHP_PREFIX/bin/php-config
 
  make

  你必须使用“export”命令指明PHP的安装路径的前缀,它可能是"/usr" "/usr/local",或其它

第二布:安装 eAccelerator

  make install

第三步:配置 eAccelerator

  eAccelerator能做为Zend或PHP的扩展。

对于大于0.9.1版本的eaccelerator,如果你有/etc/php.d目录,你应该复制eaccelerator.ini到里面去,当然你可以根据你的需要修改它。

如果没有,你需要修改你的php.ini文件(通常是/etc/php.ini)

作为Zend的扩展:

  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"

  如果你使用thread safe模式安装的PHP,你应该使用“zend_extension_ts”代替“zend_extension”

作为PHP的扩展:

  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"
 
第四步:建立缓存目录

  mkdir /tmp/eaccelerator
  chmod 0777 /tmp/eaccelerator

 

配置选项
--------

eaccelerator.shm_size
 eAccelerator使用共享内存的总数。单位是MB.
 设置为“0”,则为操作系统默认值。默认为“0”

eaccelerator.cache_dir
 硬盘缓存的目录。eAccelerator存储预编译代码,session数据,内容数据(content)和使用的入口(entres??)。这些数据也能够存储在共享内存里(为了得到更快的通道)。默认为“/tmp/eaccelerator”。

 yayu:建立这个空目录后,在有人访问php页面后会自动建立二级二维目录(0,1.....e,f)(16进制,晕)

eaccelerator.enable
 决定eAccelerator是否有效。“1”为有效,“0”为无效。默认为“1”

eaccelerator.optimizer
 是否使用内置的优化工具加速代码的执行。“1”为是,“0”为否。默认为“1”

eaccelerator.debug
 是否记录eAccelerator debug log。“1”为是,“0”为否。默认为“0”

eaccelerator.check_mtime
 是否检查php程序更新时间。“1”为是,“0”为否。如果你想改变php程序后重编译程序到共享内存,那就应该设置为“1”。默认为“1”

eaccelerator.filter
 决定哪些php文件被缓存。你可能需要指定哪些文件(如:"*.php *.phtml")需要被缓存。如果在文件前加上“!”,那么符合条件的文件将被忽略。默认为"",这以为着所有php文件都会被缓存。

eaccelerator.shm_max
 设置诸如“eaccelerator_put()”之类的函数能往共享内存里面加载数据的大小。单位为MB。“0”为不限制,默认为“0”。

eaccelerator.shm_ttl
 当共享内存空间已满,将删除在“shm_ttl”秒前没有使用的程序。默认为0,为不删除任何文件。

eaccelerator.shm_prune_period
 共享内存已满。前一次操作是在shm_prune_period秒之前,那么这一次将删除所有的旧程序。默认为“0”,意为不删除任何程序。

eaccelerator.shm_only
 是否把编译后程序缓存到硬盘上。这个选项对session数据和内容(content)缓存无效。默认为“0”,意为同时使用共享内存和硬盘做缓存。

eaccelerator.compress
 是否对缓存内容做压缩。默认为“1”,为不压缩。

eaccelerator.compress_level
 压缩的级别,默认和最高都为“9”。

eaccelerator.name_space
 一个对所有键值假拟的字符串。通过在.htaccess文件中设置的这个值,允许两个应用使用相同的键值运行在同一个主机上。

 yayu:命名空间?

eaccelerator.keys
eaccelerator.sessions
eaccelerator.content
 决定那些键,session数据和内容将被缓存,这些可能的值是:

 "shm_and_disk" - 缓存数据在共享内存和硬盘上(默认值)
 "shm"          - 缓存数据在共享内存,如果共享内存已满或者提交的数据大小超过eaccelerator.shm_max,则存储在硬盘上。
 "shm_only"     - 只缓存数据在共享内存
 "disk_only"    - 只缓存数据在硬盘
 "none"         - 不缓存数据

eaccelerator.allowed_admin_path
 允许得到管理信息和管理操作的脚本路径。


控制面板及反汇编
---------------

如果你要使用控制面板,你需要在编译eAccelerator时加上 --with-eaccelerator-info选项,这个是默认值。

复制control.php文件到你的跟目录下,并且设置这个路径到php.ini 或者 eaccelerator.ini的eaccelerator.allowed_admin_path选项。如果你不这样做,你将看不到更多的相关信息,也不能控制eAccelerator。

你可以在control.php文件中设置用户名和密码以进入控制面板

当你使用--with-eaccelerator-disassembler编译时,你需要把dasm.php和PHP_Highlight.php也放到control.php目录里面。反汇编需要在编译PHP时加上对tokenizer的支持(--enable-tokenizer)
你可以在dasm.php文件的上面得到执行反汇编时的用户名和密码


eAccelerator 函数
-----------------

函数文档请看: http://bart.eaccelerator.net/doc/phpdoc/

联系我们
--------
当你有疑问、需要补丁,提交bug,请发email给 Bart Vanbrabant

--------------------------

以下是英文全文:

eAccelerator for PHP
=====================

What is eAccelerator?
----------------------
eAccelerator is a free open source PHP  accelerator,  optimizer,  encoder  and
dynamic content cache for PHP. It increases  performance  of  PHP  scripts  by
caching them in compiled state, so that the overhead of  compiling  is  almost
completely eliminated. It also optimises  the  script  to speed  up  execution
of PHP scripts. eAccelerator typically reduces server load and  increases  the
speed of your PHP code by 1-10 times.

eAccelerator is a fork of TurckMMCache
( http://sourceforge.net/project/turckmm-cache/  by Dmitry Stogov )

eAccelerator stores compiled PHP scripts in shared memory  and  executes  code
directly from it. It creates  locks  only  for  short  time,  while  searching
compiled PHP script in the cache, so one script can be executed simultaneously
by several engines. Files that can't fit in shared memory are cached  on  disk
only.

eAccelerator contains a PHP encoder and loader. You  can  encode  PHP  scripts
using encoder.php in order to distribute them without sources.  Encoded  files
can be run on any site which  runs  PHP  with  eAccelerator.  The  sources  of
encoded scripts can't be restored because they are stored in a  compiled  form
and the encoded version doesn't contain the source. Of course, some  internals
of the scripts can  be  restored  with  different  reverse  engineering  tools
(disassemblers, debuggers, etc), but it is not trivial.

eAccelerator is compatible with Zend Optimizer's loader. Zend  Optimizer  must
be installed after eAccelerator in php.ini. If you don't use  scripts  encoded
with  Zend  Encoder  we  do  not  recommend  to  install  Zend  Optimizer with
eAccelerator.

eAccelerator does not work in CGI mode but it does work in Fast-CGI mode with
webservers like lighttpd.


Here are some other products that provide the same functionality:

 - Zend Performance Suite (http://www.zend.com/)
 - Alternative PHP Cache (http://pecl.php.net/package/APC)

Download
--------
Latest eAccelerator versions can be downloaded at the sourceforge page:
http://sourceforge.net/projects/eaccelerator/
Development snapshots from cvs can be downloaded at
http://snapshots.eaccelerator.net


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

展开全文  
收起全文