安装及配置eaccelerator-0.9.5加速PHP-5.2.1-php教程

资源魔 33 0
 操作零碎:Linux

1、装置eaccelerator-0.9.5(同时支持ZendOptimizer-3.2.2)

  一、起首装置ZendOptimizer-3.2.2

  # wget http://www.vista.ac.cn/linux/down/ZendOptimizer/ZendOptimizer-3.2.2-linux-glibc21-i386.tar.gz
  # tar zxvf ZendOptimizer-3.2.2-linux-glibc21-i386.tar.gz
  # cd ZendOptimizer-3.2.2-linux-glibc21-i386
  # ./install.sh

正在Please specify the location for installing ZendOptimizer:提醒后输出ZendOptimizer装置门路,例如/data/webserver/zend

  正在Confirm the location of your php.ini file:提醒后输出php.ini文件所正在目次,例如/data/webserver/php/etc

  正在Specify the full path to the Apache control utility (apachectl):提醒输出apachectl相对门路,例如/data/webserver/apache/bin/apachectl

  二、再装置eaccelerator-0.9.5减速软件(保举学习:PHP视频教程)

  # wget http://www.vista.ac.cn/linux/down/eaccelerator/eaccelerator-0.9.5.tar.bz2
  # tar jxvf eaccelerator-0.9.5.tar.bz2
  # cd eaccelerator-0.9.5

  指定php所正在门路:

  # export PHP_PREFIX="/data/webserver/php"
  # $PHP_PREFIX/bin/phpize
  # ./configure --enable-eaccelerator=shared --with-php-config=$PHP_PREFIX/bin/php-config
  # make
  # make install

这时候会将eaccelerator装置到php目次中,屏幕会显示eaccelerator.so所正在门路,例如:

  Installing shared extensions: /data/webserver/php/lib/php/extensions/no-debug-zts-20060613/

  记住这个门路。

  eaccelerator便可以装置为PHP扩大,也能够装置为zend扩大,如下装置为PHP扩大。

  假如存正在/etc/php.d目次,需求拷贝eaccelerator.ini到该目次下,而后修正缺省值。假如没有存正在,修正php.ini,正在[zend]以前退出如下内容(注:必需放正在[zend]以前):

[eaccelerator]
  extension="/data/webserver/php/lib/php/extensions/no-debug-zts-20060613/eaccelerator.so"
  eaccelerator.shm_size="32"
  eaccelerator.cache_dir="/data/cache/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 -p /data/cache/eaccelerator
  # chmod 0777 /data/cache/eaccelerator

  重启Apache:

 # service httpd restart

  三、反省ZendOptimizer以及eaccelerator能否装置胜利

  创立一个phpinfo.php文件,内容以下:

  <?php
      phpinfo();
  ?>

  将该文件搁置到网站目次,正在阅读器中拜访,假如呈现如下内容则装置胜利:

  This program makes use of the Zend Scripting Language Engine:
  Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
      with eAccelerator v0.9.5, Copyright (c) 2004-2006 eAccelerator, by eAccelerator
      with Zend Extension Manager v1.0.11, Copyright (c) 2003-2006, by Zend Technologies
      with Zend Optimizer v3.2.2, Copyright (c) 1998-2006, by Zend Technologies

2、eaccelerator设置装备摆设信息详解(依据民间英文阐明翻译)

extension="/data/webserver/php/lib/php/extensions/no-debug-zts-20060613/eaccelerator.so"

诠释:PHP扩大eaccelerator.so的门路。

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

eaccelerator.shm_size="32"

诠释:eaccelerator可以使用的同享内存巨细(单元为MB)。

  正在Linux下,单个过程的最年夜内存应用量受/proc/sys/kernel/sh妹妹ax中设置的数字限度(单元为字节),例如CentOS 4.4的sh妹妹ax默许值为33554432字节(33554432bytes/1024/1024=32MB)。

暂时更改该值:

# echo 字节数 > /proc/sys/kernel/sh妹妹ax

依照以上办法更改,正在每一次重启零碎时,该值会被主动复原。假如想永世更改,能够修正/etc/sysctl.conf文件,设置:

  kernel.sh妹妹ax = 字节数

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

  eaccelerator.cache_dir="/data/cache/eaccelerator"

诠释:缓存门路,能够应用饬令mkdir -p /data/cache/eaccelerator创立该目次,而后应用饬令chmod 0777 /data/cache/eaccelerator设置该目次权限为0777

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

    eaccelerator.enable="1"

诠释:关上或许封闭eaccelerator。"1"指关上,"0"指封闭。默许值为"1"。

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

  eaccelerator.optimizer="1"

诠释:关上或许封闭代码优化,开启能够放慢代码的执行速率。"1"指关上,"0"指封闭。默许值为"1"。

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

  eaccelerator.check_mtime="1"

诠释:当关上此项时,eaccelerator会正在每一次申请时反省php文件的修正工夫,看其能否被修正过,这会消耗一点工夫,假如php文件被修正过,eaccelerator会从新编译缓存该php文件。当封闭此项时,假如php文件被修正,则需求手工删除了eaccelerator缓存,能力显示被修正的php文件。"1"指关上,"0"指封闭。默许值为"1"。

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

  eaccelerator.debug="0"

诠释:关上或许封闭调试记载。当关上时,eaccelerator会将对一个缓存文件的每一次申请都写进log。关上此项只对换试eaccelerator能否有BUG时无益处。"1"指关上,"0"指封闭。默许值为"0"。

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

  eaccelerator.filter=""

诠释:决议哪些PHP文件应该被缓存。能够指定一个范畴(比方"*.php *.phtml"),这样被指定的文件就会被缓存。假如该范畴以!扫尾,被指定的文件就没有会被缓存。默许值为"",示意缓存一切的PHP文件。

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

  eaccelerator.shm_max="0"

诠释:一个用户应用例如eaccelerator_put之类的函数可以往同享内存中加载的最年夜数据。默许值为"0",示意没有限度。(单元为字节)

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

  eaccelerator.shm_ttl="0"

诠释:当不足够的闲暇同享内存去测验考试缓冲一个新剧本时,将删除了至多正在shm_ttl秒以前不被拜访过的文件。默许值为"0",示意没有测验考试从同享内存中删除了任何旧的剧本。(单元为秒)

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

  eaccelerator.shm_prune_period="0"

诠释:当不足够的闲暇同享内存去测验考试缓冲一个新剧本时,将删一切旧剧本,条件是这个测验考试正在超越shm_prune_period秒以前被执行过。默许值为"0",示意没有测验考试从同享内存中删除了任何旧的剧本。(单元为秒)

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

  eaccelerator.shm_only="0"

诠释:关上或许封闭正在磁盘上缓存编译过的剧本。这个参数对会话数据以及内容缓存不成果。默许值为"0",示意应用磁盘以及同享内存来缓存。

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

  eaccelerator.compress="1"

诠释:关上或许封闭缓存内容紧缩。"1"指关上,"0"指封闭。默许值为"1"。

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

  eaccelerator.compress_level="9"

诠释:内存紧缩的级别。默许值为"9",示意最年夜紧缩。

  参考材料:

  一、Installing from source (http://www.eaccelerator.net/wiki/InstallFromSource)

  二、eAccelerator settings (http://www.eaccelerator.net/wiki/Settings)

以上就是装置及设置装备摆设eaccelerator-0.9.5减速PHP-5.2.1的具体内容,更多请存眷资源魔其它相干文章!

标签: 优化 加速 php开发教程 php开发资料 php开发自学 eaccelerator ZendOptimizer

抱歉,评论功能暂时关闭!