Use APC to cache PHP

Source: Internet
Author: User
Tags apc
. Overview: AlternativePhpCache (APC) is a free and public optimized code cache for php. It is used to provide free, public, and robust architectures to cache and optimize php intermediate code. Note: 1. in Windows, APC requires a temporary path and Web service appliance... SyntaxHighlighter. all (

 

. Overview:

Alternative Php Cache (APC) is a free and public php optimized code Cache. It is used to provide free, public, and robust architectures to cache and optimize php intermediate code.

 

Note:

1. in Windows, APC requires a temporary path and the Web server has the write permission. It checks the TMP, TEMP, and USERPROFILE environment variables in sequence. if they are not set, use the WINDOWS directory.

 

2. APC does not support distributed deployment.

 

 

II. installation:

Download the PECL dll package from pecl4win.net. php and put it in the PHP5/ext directory. In fact, the pecl package corresponding to php5.2.5 already contains this file.

 

III. configuration

Open php. ini and add the code:

Extension = php_apc.dll

 

[APC]

Apc. enabled = 1

Apc. shm_segments = 1

Apc. shm_size = 64

Apc. max_file_size = 10 M

Apc. stat = 1

IV. script test:

Restart the Web server and test:

1). set the entries to be cached.

Store. php

$ Bar = 'bar ';

Apc_store ('foo', $ bar );

?>

2). obtain the cached entries.

Fetch. php

Var_dump (apc_fetch ('Foo '));

?>

Run store. php and run fetch. php to check the effect.

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.