麻辣堂|资源主站|开发论坛|在线手册
首页 Apache Linux Java MySQL 注册帮助 
PHP项目开发组是PHP开发资源网于2007组年建成立的项目开发团队,目前核心开发成员有27人, 项目协作成员8名.下设7个开发组,主要承接大/中型网站项目开发任务。

    由于开发任务较多,人员比较紧张,现面向社会招聘全职或者兼职开发人员,不管你是在校大学生,还是全职开发人员,以及SOHO都可以联系本站,我们可以长期合作,并为您带来丰厚的报酬。
  您现在的位置:PHP开发资源网 > 麻辣堂 > 详细资料
待解决
PHP 加密加速 eaccelerator
悬赏分:20 - 2007年08月15日

这两天产品要出包,可是因为在Linux centos 2.4.21-27.0.2.EL 上MMcache怎么都不能正确解析php我一直在郁闷。。试了2个php版本都不ok后今天上午终于忍不住了开始上网查资料。最后发现了mmcache的后续版本eaccelerator目前最高版本是eaccelerator-0.9.2a.tar.gz他成功的解决了我的问题。下面写出如何在linux下安装使用:
=================
以下是转载:说明部分也就是对README的翻译(我看后的感觉)
--------------
eAccelerator 是一套 PHP 加速程式,和 Zend Accelerator、Turck MMCache for PHP 的作用是相同的。
官方網站下載:http://sourceforge.net/project/show...group_id=122249
目前是 0.9.2a 版
wget http://voxel.dl.sourceforge.net/ ... rator-0.9.2a.tar.gz
tar xvzf eaccelerator-0.9.2a.tar.gz
cd eaccelerator



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

如果找不到 phpize 這個程式,可能您少安裝 php-devel 這個套件,請補安裝
yum install php-devel

[root@localhost eaccelerator]# $PHP_PREFIX/bin/phpize
configure.in:9: warning: underquoted definition of PHP_WITH_PHP_CONFIG
run info '(automake)Extending aclocal'
or see http://sources.redhat.com/automa ... l#Extending-aclocal
configure.in:32: warning: underquoted definition of PHP_EXT_BUILDDIR
configure.in:33: warning: underquoted definition of PHP_EXT_DIR
configure.in:34: warning: underquoted definition of PHP_EXT_SRCDIR
configure.in:35: warning: underquoted definition of PHP_ALWAYS_SHARED
acinclude.m4:19: warning: underquoted definition of PHP_PROG_RE2C
Configuring for:
PHP Api Version: 20020918
Zend Module Api No: 20020429
Zend Extension Api No: 20021010

Libraries have been installed in:
/tmp/eaccelerator/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
(It is safe to ignore warnings about tempnam and tmpnam).

[root@localhost eaccelerator]# make install
Installing shared extensions: /usr/lib/php4/

底下參考了 無限論壇 pigo 的文章
修改 php.in , 增加以下設定 , 有兩種設定 , 各位可以試試看那種能動
第一種設定
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"
說明 : 如果你的PHP是thread sefe 模式, 那麼必須把第一行 zend_extension 改成 zend_extension_ts
說明2:第一行的目錄要看您自己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"
說明 : 如果這個設定不行 , 則要把絕對目錄加在 extensino 參數內
說明2: 以上的設定中有一行 eaccelerator.shm_size="16" , 這是指使用 16M 的快取記憶體,各位可以斟酌修改
若記憶體用光怎麼辦 ??? 沒關係.他會自動把快取存在 eaccelerator.cache_dir 所指定的目錄
所以各位可以安心使用

Step4: 建立以下目錄
mkdir /tmp/eaccelerator
chmod 0777 /tmp/eaccelerator

Step5: 重新啟動您的 Apache
並且使用 phpinfo() 指令秀在網頁中 , 會發現 eAccelerator 被載入了
您會發現在 phpinfo() 前面的資訊發現以以下字串
This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.0.3, Copyright (c) 1998-2004 Zend Technologies
with eAccelerator v0.9.2, Copyright (c) 2004-2004 eAccelerator, by eAccelerator

附件(.png): eaccelerator.png 13.3kb 已被下载 1 次。

如果您沒有發現上面的字串
請檢查 apache 的 error log 應該會有錯誤訊息產生
若您安裝都成功.恭喜您,您的程式都不需要修改 , 您的網站自然就會加快很多 , 一般討論區程式快 2 倍速度是正常的

測試
/usr/bin/ab -c 50 -n 1000 localhost/index.html
-n 為請求次數,-c 則為同時處理數量,亦即模仿多少台電腦同時訪問
50 個連線,共有 1000 連線

转载完成
==================
这个是我今天安装后的使用情况
=============
安装成功后:
cp eaccelerator.php apachepath/htdocs/
在firefox上就可以查看eaccelerator的情况了。


=========
使用
1:cp encode.php /var/eyou/
2: phppath/bin/php encode.php -f aa.php -o apachepath/htdocs/aa.php

这样就对aa.php进行编码成功。


==============
这个是免费的哟。而且可以对PHP5进行加密。各位可以好好的试试。。

提问者:Double_ycn   08-15 17:05
答复
路过。。。顺便帮顶:)
回答者:玉米づ冰冻可乐 - 瓦岗村民 8-22 09:10
我也来回答:
不管你有没有帮助我们,瓦岗寨8万村民将感谢你。。。。。

为防止灌水,您需要计算一道数学题: 答案:
42 + 70 = ? 请将计算结果填在上面

 
[]
©2007 PhpRes.COM