Home > php教程 > php手册 > PHP 缓冲的免费实现方法

PHP 缓冲的免费实现方法

WBOY
Release: 2016-06-13 10:09:51
Original
1252 people have browsed it

作 者: 徐永久
我们知道 Zend 有免费的优化引擎针对 PHP 而作,但是 FreeLAMP 这次采用的是一个叫做 PHP Accelerator 的缓冲产品。
我们在 “LAMP 加速” 这篇文章中阐述过加速的几种办法,其中提到了 PHP Accelerator,它的安装方法十分简单,但是需要去他的网站获取一个激活键。
一、下载:
http://www.php-accelerator.co.uk/download.php
二、获取激活键并安装:
http://www.php-accelerator.co.uk/activate.php
注册自己的 SERVER_NAME 后,你会得到下面的提示:
Your key for www.freelamp.com is 8edfd13946c96309244fcca309415902
Now you must set the key for www.freelamp.com in your site configuration.
For single domains not using virtual hosts
The key can be set in the php.ini file as follows:
# PHPA key for www.freelamp.com
#
phpa.registration_key = 8edfd13946c96309244fcca309415902
For domains setup as a virtual host
Add the key to the domain specific section for your web server.
# www.freelamp.com VHost entry
#
ServerName www.freelamp.com
# ... (other vhost specific config)
# php settings
php_value phpa.registration_key 8edfd13946c96309244fcca309415902
# also enable phpa if set to off in the php.ini (the default is on)
php_value phpa 1
具体的 phpa 值的设置,可以参考软件随带的 CONFIGURATION 文件的配置。
由于大多数网站是虚拟主机配置,所以,建议采用 php_value phpa. 的方式设置。
例如:
php_value phpa.tweaks off
php_value phpa.cache_dir /tmp
php_value phpa.file_perms 400
php_value phpa.ignore_files "/index.php, /a/test.php"
# php_value phpa.ignore_dirs "/data/WWW/site1/,/cache/"
php_value phpa.shm_size 8
php_value phpa.shm_key 0xc0deb00
php_value phpa.shm_perms 664
三、设置 php.ini
假设我们把下载后的文件解开到 /usr/local/php ,那么在 php.ini 中加入:
zend_extension=/usr/local/php/php_accelerator_1.2p2.so
并注释掉原来的 Zend 优化引擎:
# zend_extension=/usr/local/Zend/lib/ZendOptimizer.so

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template