PHP cache (accelerator) APC and eaccelerator

Source: Internet
Author: User
Tags apc

1. APC

Alternative PHP cache (APC) is an effective open-source high-speed buffer storage tool for PHP. It can cache the opcode's PHP intermediate code.

Php apc provides two caching functions: cache opcode (target file), which is called apc_compiler_cache. It also provides some interfaces for PHP developers to resident user data in the memory, which is called apc_user_cache. Here we mainly discuss the configuration of PHP-APC.

(1) Installation

CD/usr/local/PHP/bin

./PECL install APC

(2) download PHP. ini from/usr/local/PHP/lib and add extension = APC. So

(3) Restart PHP,/usr/local/PHP/sbin/PHP-FPM.

2. eaccelerator

Accelerator is a free and open source PHP accelerator. It optimizes and dynamically caches content, improves the cache performance of PHP scripts, and enables PHP scripts to be compiled, the server overhead is almost completely eliminated. It also optimizes scripts to accelerate execution efficiency. Improve the code execution efficiency of your PHP program by 1-10 times;

(1) download http://sourceforge.net/projects/eaccelerator/files/eaccelerator/eAccelerator%200.9.6.1/eaccelerator-0.9.6.1.zip/download

(2)
After decompression, CD/home/admin/eaccelerator-0.9.6.1

(3) Compile

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

(4) Installation

make install

(5) Configuration

If Zend is installed, the configuration is as follows:

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"

The common configuration is as follows:

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"

(6) create a cache folder

mkdir /tmp/eacceleratorchmod 0777 /tmp/eaccelerator

Reference URL:

Http://cn.php.net/manual/en/apc.installation.php

Http://eaccelerator.net/wiki/InstallFromSource


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.