PHP APC Cache

Source: Internet
Author: User

See official documentation

http://php.net/manual/en/book.apc.php

The alternative PHP cache (APC) is a free and open opcode cache for PHP. Its goal are to provide a free, open, and robust framework for caching and optimizing PHP intermediate code.


You can see if the APC extension is installed in the following ways

$ php -r  ' phpinfo (); '  |grep apcapcapc.cache_by_default => On => Onapc.canonicalize =>  On => Onapc.coredump_unmap => Off => Offapc.enable_cli =>  off => offapc.enabled => on => onapc.file_md5 => off  => Offapc.file_update_protection => 2 => 2apc.filters =>  No value => no valueapc.gc_ttl => 3600 => 3600apc.include_ once_override => off => offapc.lazy_classes => off =>  Offapc.lazy_functions => off => offapc.max_file_size => 1m =>  1Mapc.mmap_file_mask => no value => no valueapc.num_files_hint  => 1000 => 1000apc.preload_path => no value =>&nBsp;no valueapc.report_autofilter => off => offapc.rfc1867 => off  => offapc.rfc1867_freq => 0 => 0apc.rfc1867_name => apc_ upload_progress => apc_upload_progressapc.rfc1867_prefix => upload_ =>  upload_apc.rfc1867_ttl => 3600 => 3600apc.serializer => default = > defaultapc.shm_segments => 1 => 1apc.shm_size => 32m = > 32mapc.shm_strings_buffer => 4m => 4mapc.slam_defense => on  => Onapc.stat => On => Onapc.stat_ctime => Off =>  Offapc.ttl => 0 => 0apc.use_request_time => On =>  Onapc.user_entries_hint => 4096 => 4096apc.user_ttl => 0 =>  0apc.write_lock&nBsp;=> on => on 


1. Installing the APC Extension


TAR-ZXVF apc-3.1.14.tgz

CD APC-3.1.14

Phpize

./configure--with-php-config=/data/app_platform/php/bin/php-config

Make && make install


2. Configure PHP.ini

The following parameters are recommended for use

Extension=apc.so

Apc.enabled=1

apc.shm_size=128m

apc.ttl=7200

apc.user_ttl=7200

Apc.enable_cli=1

3. Configuring APC Parameters

Reference documents

http://php.net/manual/en/apc.configuration.php

There are two top questions to consider: 1. How much memory space is allocated to APC. 2. For each request, let APC check if a file has been changed. The two parameters are Apc.shm_size and Apc.stat.

APC comes with a monitoring page apc.php, you can copy apc.php from the source package to an Nginx virtual host, and then view the status of the APC cache through http://xxxxxx/apc.php.

If you install the GD extension of PHP, you can see the chart


Apc.shm_size




This article is from the Linux SA John blog, so be sure to keep this source http://john88wang.blog.51cto.com/2165294/1579158

PHP APC Cache

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.