Home Backend Development PHP Tutorial 网站加速 PHP 缓冲的免费实现方法_PHP

网站加速 PHP 缓冲的免费实现方法_PHP

Jun 01, 2016 pm 12:32 PM
php free accelerate accomplish method website

我们知道 Zend 有免费的优化引擎针对 PHP 而作,但是 FreeLAMP 这次采用的是一个叫做 PHP Accelerator 的缓冲产品。

  我们在 “LAMP 加速” 这篇文章中阐述过加速的几种办法,其中提到了 PHP Accelerator,它的安装方法十分简单,但是需要去他的网站获取一个激活键。

language="JavaScript1.1" src="http://img.bitscn.com/upimg/allimg/070123/1836470.jpg" />

  一、下载:

  www.php-accelerator.co.uk/download.php

  二、获取激活键并安装:

  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

  重新启动 Apache ,用浏览器浏览一个任意 PHP 页面可以看到 /tmp 下面生成了一些 phpa 开头的文件。另外一个检查缓冲是否起作用的办法是看 phpinfo() 的输出,原来的 Zend 优化引擎的说明部分,已经被显示成:

  This program makes use of the Zend Scripting Language Engine:

  Zend Engine v1.1.1, Copyright © 1998-2001 Zend Technologies

  with the PHP Accelerator v1.2p2, Copyright © 2001-2002, by Nick Lindridge

  需要说明的是,安装 INSTALL 安装说明上的办法,其中的 .so 文件和真实的 .so 文件有差异,所以,你在安装的时候需要注意到这个区别。

  四、调整缓冲大小

  PHP Accelerator 提供了缓冲管理命令:

  phpa_cache_admin -mv 观察内存的缓冲情况

  phpa_cache_admin -fv 观察文件的缓冲情况

  phpa_cache_admin -k 设置缓冲大小

  五、总结

  该软件提供的 INSTALL 文件阐述了关于性能上的一些说法,笔者不在这里赘述。

  需要说明的是,FreeLAMP.com 的文章目前不是 PHP 架构的,但是论坛系统是 PHP 架构的,所以性能上的提升只会是论坛系统的提升。

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

CakePHP Project Configuration CakePHP Project Configuration Sep 10, 2024 pm 05:25 PM

In this chapter, we will understand the Environment Variables, General Configuration, Database Configuration and Email Configuration in CakePHP.

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

CakePHP Date and Time CakePHP Date and Time Sep 10, 2024 pm 05:27 PM

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

CakePHP File upload CakePHP File upload Sep 10, 2024 pm 05:27 PM

To work on file upload we are going to use the form helper. Here, is an example for file upload.

CakePHP Routing CakePHP Routing Sep 10, 2024 pm 05:25 PM

In this chapter, we are going to learn the following topics related to routing ?

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

CakePHP Creating Validators CakePHP Creating Validators Sep 10, 2024 pm 05:26 PM

Validator can be created by adding the following two lines in the controller.

CakePHP Working with Database CakePHP Working with Database Sep 10, 2024 pm 05:25 PM

Working with database in CakePHP is very easy. We will understand the CRUD (Create, Read, Update, Delete) operations in this chapter.

See all articles