Home php教程 php手册 php加速器eAccelerator的配置参数、API详解

php加速器eAccelerator的配置参数、API详解

Jun 06, 2016 pm 08:22 PM
eaccelerator php

eAccelerator是一个开源PHP加速器,优化程序,编码器和动态内容缓存。它通过在编译状态下对它们进行缓存以提高PHP脚本的性能,所以那些 系统开销在编译时几乎可

它还能够对脚本进行优化以便加速它们的执行速度。利用eAccelerator可以减少服务器的负载并提高PHP代码的执行时间。

eAccelerator配置选项:

复制代码 代码如下:


zend_extension_ts=”X:Appphp-5.2.13-Win32exteaccelerator.dll”
eaccelerator.shm_size=”32″
eaccelerator.cache_dir=”X:Appphp-5.2.13-Win32 emp”
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″
zend_extension_manager.optimizer_ts=”X:AppendendOptimizer-3.3.0libOptimizer-3.3.0″
zend_extension_ts=”X:AppendendOptimizer-3.3.0libendExtensionManager.dll”
zend_optimizer.optimization_level=”512″


eAccelerator配置参数详细说明:

eaccelerator.shm_size

指定 eAccelerator 能够使用的共享内存数量,单位:MB。“0″ 代表操作系统默认。默认值为 “0″。

eaccelerator.cache_dir

用户磁盘缓存的目录。eAccelerator 在该目录中存储预编译代码、session 数据、内容等。相同的数据也可以存储于共享内存中(以获得更快的存取速度)。默认值为 “/tmp/eaccelerator”。

eaccelerator.enable

开启或关闭 eAccelerator。”1″ 为开启,”0″ 为关闭。默认值为 “1″。

eaccelerator.optimizer

开启或关闭内部优化器,可以提升代码执行速度。”1″ 为开启,”0″ 为关闭。默认值为 “1″。

eaccelerator.debug

开启或关闭调试日志记录。”1″ 为开启,”0″ 为关闭。默认值为 “0″。

eaccelerator.check_mtime

开启或关闭 PHP 文件改动检查。”1″ 为开启,”0″ 为关闭。如果您想要在修改后重新编译 PHP程序则需要设置为 “1″。默认值为 “1″。

eaccelerator.filter

判断哪些 PHP 文件必须缓存。您可以指定缓存和不缓存的文件类型(如 “*.php *.phtml”等),如果参数以 “!” 开头,则匹配这些参数的文件被忽略缓存。默认值为 “”,即,,所有 PHP 文件都将被缓存。

eaccelerator.shm_max

当使用 ” eaccelerator_put() ” 函数时禁止其向共享内存中存储过大的文件。该参数指定允许存储的最大值,单位:字节 (10240, 10K, 1M)。”0″ 为不限制。默认值为 “0″。

eaccelerator.shm_ttl

当 eAccelerator 获取新脚本的共享内存大小失败时,它将从共享内存中删除所有在最后 “shm_ttl” 秒内无法存取的脚本缓存。默认值为 “0″,即:不从共享内春中删除任何缓存文件。

eaccelerator.shm_prune_period

当 eAccelerator 获取新脚本的共享内存大小失败时,他将试图从共享内存中删除早于“shm_prune_period” 秒的缓存脚本。默认值为 “0″,即:不从共享内春中删除任何缓存文件。

eaccelerator.shm_only

允许或禁止将已编译脚本缓存在磁盘上。该选项对 session 数据和内容缓存无效。默认值为 “0″,即:使用磁盘和共享内存进行缓存。

eaccelerator.compress

允许或禁止压缩内容缓存。默认值为 “1″,即:允许压缩。

eaccelerator.compress_level

指定内容缓存的压缩等级。默认值为 “9″,为最高等级。

eaccelerator.name_sapce

一个所有键(keys)的前缀字符串。如果设置该前缀字符串则允许 .htaccess 或者 主配置文件在相同主机上运行两个相同的键名。

eaccelerator.keys
eaccelerator.sessions
eaccelerator.content

判断哪些键(keys)、session 数据和内容将被缓存。可用参数值为:

1.“shm_and_disk” – 同时在共享内存和磁盘中缓存数据(默认值);
2.“shm” – 如果共享内存用尽或者数据容量大于 “eaccelerator.shm_max”,则在共享内存或磁盘中缓存数据;
3.“shm_only” – 仅在共享内存中缓存数据;
4.“disk_only” – 仅在磁盘中缓存数据;
5.“none” – 禁止缓存数据。


eAccelerator应用程序接口(API):

eaccelerator_put($key, $value, $ttl=0)

将 $value 存储在共享内存中,并存储 $tll 秒。

eaccelerator_get($key)

从共享内存中返回 eaccelerator_put() 函数所存储的缓存数值,如果不存在或者已经过期,则返回 null。

eaccelerator_rm($key)

从共享内存中删除 $key。

eaccelerator_gc()

删除所有过期的键(keys)

eaccelerator_lock($lock)

创建一个指定名称的锁(lock)。该锁可以通过 eaccelerator_unlock() 函数解除,在请求结束时也会自动解锁。例如:

eaccelerator_unlock($lock)

解除指定名称的锁(lock)。

eaccelerator_set_session_handlers()

安装 eAccelerator session 句柄。从 PHP 4.2.0 以后,您可以通过设置 php.ini 中的 “session.save_handler=eaacelerator” 安装 eAccelerator 句柄。

eaccelerator_cache_output($key, $eval_code, $ttl=0)

在共享内存中缓存 $eval_code 的输出,缓存 $ttl 秒。可以调用 mmcach_rm() 函数删除相同 $key 的输出。例如:

eaccelerator_cache_result($key, $eval_code, $ttl=0)

在共享内存中缓存 $eval_code 的结果,缓存 $ttl 秒。可以调用 mmcach_rm() 函数删除相同 $key 的结果。例如:

eaccelerator_cache_page($key, $ttl=0)

缓存整个页面,且缓存 $ttl 秒。例如:

eaccelerator_rm_page($key)

从缓存中删除由 eaccelerator_cache_page() 函数创建的相同 $key 的页。

eaccelerator_encode($filename)

返回 $filename 文件经过编译后的编码。

eaccelerator_load($code)

加载被 eaccelerator_encode() 函数编码过的脚本。

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

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

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)

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

Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Explain JSON Web Tokens (JWT) and their use case in PHP APIs. Apr 05, 2025 am 12:04 AM

JWT is an open standard based on JSON, used to securely transmit information between parties, mainly for identity authentication and information exchange. 1. JWT consists of three parts: Header, Payload and Signature. 2. The working principle of JWT includes three steps: generating JWT, verifying JWT and parsing Payload. 3. When using JWT for authentication in PHP, JWT can be generated and verified, and user role and permission information can be included in advanced usage. 4. Common errors include signature verification failure, token expiration, and payload oversized. Debugging skills include using debugging tools and logging. 5. Performance optimization and best practices include using appropriate signature algorithms, setting validity periods reasonably,

How do you parse and process HTML/XML in PHP? How do you parse and process HTML/XML in PHP? Feb 07, 2025 am 11:57 AM

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

Explain late static binding in PHP (static::). Explain late static binding in PHP (static::). Apr 03, 2025 am 12:04 AM

Static binding (static::) implements late static binding (LSB) in PHP, allowing calling classes to be referenced in static contexts rather than defining classes. 1) The parsing process is performed at runtime, 2) Look up the call class in the inheritance relationship, 3) It may bring performance overhead.

PHP Program to Count Vowels in a String PHP Program to Count Vowels in a String Feb 07, 2025 pm 12:12 PM

A string is a sequence of characters, including letters, numbers, and symbols. This tutorial will learn how to calculate the number of vowels in a given string in PHP using different methods. The vowels in English are a, e, i, o, u, and they can be uppercase or lowercase. What is a vowel? Vowels are alphabetic characters that represent a specific pronunciation. There are five vowels in English, including uppercase and lowercase: a, e, i, o, u Example 1 Input: String = "Tutorialspoint" Output: 6 explain The vowels in the string "Tutorialspoint" are u, o, i, a, o, i. There are 6 yuan in total

What are PHP magic methods (__construct, __destruct, __call, __get, __set, etc.) and provide use cases? What are PHP magic methods (__construct, __destruct, __call, __get, __set, etc.) and provide use cases? Apr 03, 2025 am 12:03 AM

What are the magic methods of PHP? PHP's magic methods include: 1.\_\_construct, used to initialize objects; 2.\_\_destruct, used to clean up resources; 3.\_\_call, handle non-existent method calls; 4.\_\_get, implement dynamic attribute access; 5.\_\_set, implement dynamic attribute settings. These methods are automatically called in certain situations, improving code flexibility and efficiency.

PHP and Python: Comparing Two Popular Programming Languages PHP and Python: Comparing Two Popular Programming Languages Apr 14, 2025 am 12:13 AM

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP: A Key Language for Web Development PHP: A Key Language for Web Development Apr 13, 2025 am 12:08 AM

PHP is a scripting language widely used on the server side, especially suitable for web development. 1.PHP can embed HTML, process HTTP requests and responses, and supports a variety of databases. 2.PHP is used to generate dynamic web content, process form data, access databases, etc., with strong community support and open source resources. 3. PHP is an interpreted language, and the execution process includes lexical analysis, grammatical analysis, compilation and execution. 4.PHP can be combined with MySQL for advanced applications such as user registration systems. 5. When debugging PHP, you can use functions such as error_reporting() and var_dump(). 6. Optimize PHP code to use caching mechanisms, optimize database queries and use built-in functions. 7

See all articles