5 月 102013
 

Alternative PHP Cache (APC) 是一个开放自由的PHP opcode 缓存。它的目标是提供一个自由、 开放,和健全的框架用于缓存和优化PHP的中间代码。

http://pecl.php.net/package/apc

[root@localhost ~]# yum install php-pear

[root@localhost ~]# rpm -lq php-pear |grep /usr/bin/pear
/usr/bin/pear
/usr/bin/peardev
[root@localhost ~]# rpm -lq php-pear |grep /usr/bin/pecl
/usr/bin/pecl
[root@localhost ~]#

[root@localhost ~]# yum install php-devel

[root@localhost ~]# rpm -lq php-devel |less |grep phpize
/usr/bin/phpize
/usr/lib/php/build/phpize.m4
/usr/share/man/man1/phpize.1.gz
[root@localhost ~]#

[root@localhost ~]# yum install gcc make

[root@localhost ~]# yum install pcre-devel

[root@localhost ~]# pecl install http://pecl.php.net/get/APC-3.1.9.tgz

Build process completed successfully
Installing ‘/usr/include/php/ext/apc/apc_serializer.h’
Installing ‘/usr/lib/php/modules/apc.so’
install ok: channel://pecl.php.net/APC-3.1.9
configuration option “php_ini” is not set to php.ini location
You should add “extension=apc.so” to php.ini
[root@localhost ~]#

[root@localhost ~]# vi /etc/php.ini
extension=apc.so

php-apc-01 php-apc-02

eAccelerator is a free open-source PHP accelerator & optimizer. It increases the performance of PHP scripts by caching them in their compiled state, so that the overhead of compiling is almost completely eliminated. It also optimizes scripts to speed up their execution. eAccelerator typically reduces server load and increases the speed of your PHP code by 1-10 times.

eAccelerator stores compiled PHP scripts in shared memory and executes code directly from it. It creates locks only for a short time, while searching for a 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 was born in December 2004 as a fork of the Turck MMCache project. Turck MMCache was created by Dmitry Stogov and much of the eAccelerator code is still based on his work.

[root@localhost ~]# wget https://github.com/eaccelerator/eaccelerator/tarball/master

[root@localhost ~]# tar xzf eaccelerator-eaccelerator-42067ac.tar.gz
[root@localhost ~]# cd eaccelerator-eaccelerator-42067ac
[root@localhost eaccelerator-eaccelerator-42067ac]# ls
AUTHORS        doc                     ea_restore.h   opcodes.c
bugreport.php  eaccelerator.c          ea_store.c     opcodes.h
ChangeLog      eaccelerator.h          ea_store.h     optimize.c
config.m4      eaccelerator.ini        fnmatch.c      PHP_Highlight.php
config.w32     eaccelerator_version.h  fnmatch.h      README
control.php    ea_dasm.c               Makefile.frag  README.win32
COPYING        ea_dasm.h               Makefile.in    win32
dasm.php       ea_info.c               mm.c
debug.c        ea_info.h               mm.h
debug.h        ea_restore.c            NEWS
[root@localhost eaccelerator-eaccelerator-42067ac]#php-eaccelerator-01

php-eaccelerator-02 php-eaccelerator-03

[root@localhost eaccelerator-eaccelerator-42067ac]# yum install php-devel gcc make

[root@localhost eaccelerator-eaccelerator-42067ac]# phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
[root@localhost eaccelerator-eaccelerator-42067ac]#

[root@localhost eaccelerator-eaccelerator-42067ac]# ./configure –enable-eaccelerator=shared –with-php-config=/usr/bin/php-config
[root@localhost eaccelerator-eaccelerator-42067ac]# make
[root@localhost eaccelerator-eaccelerator-42067ac]# make install

[root@localhost eaccelerator-eaccelerator-42067ac]# vi /etc/php.ini
extension=eaccelerator.so

[root@localhost eaccelerator-eaccelerator-42067ac]# vi /var/www/html/index.php
<?php phpinfo(); ?>

php-eaccelerator-04

[root@localhost httpd-2.2.24]# yum install gcc make perl
[root@localhost httpd-2.2.24]# ./configure –prefix=/usr/local/apache \
> –enable-so –enable-rewrite
[root@localhost httpd-2.2.24]# make
[root@localhost httpd-2.2.24]# make install

[root@localhost php-5.2.17]# yum install libxml2-devel
[root@localhost php-5.2.17]# ./configure –prefix=/usr/local/php \
> –with-apxs2=/usr/local/apache/bin/apxs \
[root@localhost php-5.2.17]# make
[root@localhost php-5.2.17]# make install

[root@localhost php-5.2.17]# cp php.ini-dist /usr/local/php/lib/php.ini
[root@localhost php-5.2.17]# export PATH=/usr/local/php/bin:$PATH

修改Apache配置文件以支持PHP
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>

AddType application/x-httpd-php .php

[root@localhost ~]# /usr/local/apache/bin/apachectl start

[root@localhost ~]# vi /usr/local/apache/htdocs/index.php
<?php phpinfo(); ?>

[root@localhost ~]# tar xzf ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz
[root@localhost ~]# cd ZendOptimizer-3.3.9-linux-glibc23-i386/data/5_2_x_comp
[root@localhost 5_2_x_comp]# cp ZendOptimizer.so /usr/local/php/lib/php

[root@localhost 5_2_x_comp]# vi /usr/local/php/lib/php.ini
extension=/usr/local/php/lib/php/ZendOptimizer.so

 

 

 

 

php-zendoptimizer-01 php-zendoptimizer-02 php-zendoptimizer-03

 

相关下载:
(1)APC 3.1.9 (2) eAccelerator 42067ac (3)ZendOptimizer 3.3.9 i386 (4) ZendOptimizer 3.3.9 x86_64

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)