Home Backend Development PHP Tutorial Detailed explanation of APC configuration_PHP tutorial

Detailed explanation of APC configuration_PHP tutorial

Jul 13, 2016 pm 05:44 PM
apc php.ini Install article Detailed explanation Configuration

I. APC installation configuration

Refer to my article

II. Detailed explanation of the php.ini configuration item [APC] section

[apc]

; alternative php cache is used to cache and optimize php intermediate code

apc.cache_by_default = on

;sys

; Whether to enable buffering by default for all files.

; If set to off and used with the apc.filters directive starting with a plus sign, files will only be cached if they match the filter.

apc.enable_cli = off

;sys

; Whether to enable apc functionality for the cli version, turn this directive on only for testing and debugging purposes.

apc.enabled = on

; Whether to enable apc. If apc is statically compiled into php and you want to disable it, this is the only way.

apc.file_update_protection = 2

;sys

; When you modify files on a running server, you should perform atomic operations.

; That is, first write to a temporary file, and then rename (mv) the file to the final name.

; Text editors and programs such as cp and tar do not operate in this way, resulting in the possibility of buffering incomplete files.

; The default value 2 means that when accessing a file, if the modification time is found to be less than 2 seconds from the access time, no buffering will be performed.

; The unlucky visitor may get corrupted content, but the bad effect is not amplified by caching.

; If you can ensure that all update operations are atomic, you can turn off this feature with 0.

; If your system updates slowly due to heavy IO operations, you may need to increase this value.

apc.filters =

;sys

; A comma-separated list of POSIX extended regular expressions.

; If the source file name matches any of the patterns, the file is not cached.

; Note that the file name used to match is the file name passed to include/require, not the absolute path.

; If the first character of the regular expression is "+" it means that any files matching the expression will be cached,

; If the first character is "-" then any matches will not be cached. "-" is the default value and can be omitted.

apc.ttl = 0

;sys

; The number of seconds a cache entry is allowed to stay in the buffer. 0 means never times out. The recommended value is 7200~36000.

; Setting to 0 means that the buffer may become filled with old cache entries, preventing new entries from being cached.

apc.user_ttl = 0

;sys

; Similar to apc.ttl, but for each user, the recommended value is 7200~36000.

; Setting to 0 means that the buffer may become filled with old cache entries, preventing new entries from being cached.

apc.gc_ttl = 3600

;sys

; The number of seconds a cache entry can exist in the garbage collection table.

; This value provides a safety measure even if a server process crashes while executing a cached source file,

; and the source file has been modified, the memory allocated for the old version will not be reclaimed until this ttl value is reached.

; Set to zero to disable this feature.

apc.include_once_override = off

;sys

; There is currently no documentation for this command, see: http://pecl.php.net/bugs/bug.php?id=8754

; Please keep it off, otherwise it may cause unexpected results.

apc.max_file_size = 1m

;sys

; Prevent files larger than this size from being cached.

apc.mmap_file_mask =

;sys

; If mmap support is compiled for apc using --enable-mmap (enabled by default),

; The value here is the mktemp-style file mask passed to the mmap module (the recommended value is "/tmp/apc.xxxxxx").

; This mask is used to determine whether the memory mapped area should be file-backed or shared memory backed.

; For direct file-backed memory mapping, set it to "/tmp/apc.xxxxxx" (exactly 6 x's).

; To use posix-style shm_open/mmap, it needs to be set to "/apc.shm.xxxxxx".

; You can also set to "/dev/zero" to use the kernel's "/dev/zero" interface for anonymously mapped memory.

; Not defining this directive forces the use of anonymous mapping.

apc.num_files_hint = 1000

;sys

; The approximate number of different source files that may be included or requested on the web server (recommended value is 1024~4096).

; If you are not sure, set to 0; This setting is mainly used for sites with thousands of source files.

apc.optimization = 0

; Optimization level (recommended value is 0).

; A positive integer value enables the optimizer, with higher values ​​using more aggressive optimizations.

; Higher values ​​may have very limited speed improvements, but are currently experimental.

apc.report_autofilter = off

;sys

; Whether to record all scripts that are automatically not cached due to early/late binding reasons.

apc.shm_segments = 1

;sys

; The number of shared memory blocks allocated for the compiler buffer (recommended value is 1).

; If apc has exhausted shared memory and the apc.shm_size directive has been set to the maximum allowed by the system,

; You can try increasing this value.

apc.shm_size = 30

;sys

; The size of each shared memory block (in MB, the recommended value is 128~256).

; Some systems (including most BSD variants) have a very small default shared memory block size.

apc.slam_defense = 0

;sys (It is against the use of this command, it is recommended to use the apc.write_lock command)

; On a very busy server, whether starting a service or modifying a file,

; can cause a race condition due to multiple processes trying to cache a file at the same time.

; This directive is used to set the percentage at which the process skips the caching step when processing uncached files.

; For example, setting it to 75 means that there is a 75% probability of not caching when an uncached file is encountered, thereby reducing the chance of collision.

; Encouraged to be set to 0 to disable this feature.

apc.stat = on

;sys

; Whether to enable script update checking.

; Be very careful when changing this directive value.

; The default value on means that apc checks whether the script has been updated every time it is requested,

; Automatically recompile and cache the compiled content if updated. However, doing so has a negative impact on performance.

; If set to off, no checking is performed, thus greatly improving performance.

; But in order for the updated content to take effect, you must restart the web server.

; This directive is also valid for include/require files. But it should be noted that

; If you use relative paths, apc must check to locate the file every include/require.

; Using absolute paths can skip the check, so you are encouraged to use absolute paths for include/require operations.

apc.user_entries_hint = 100

;sys

; Similar to the num_files_hint directive, but for each different user.

; If you are not sure, set to 0.

apc.write_lock = on

;sys

; Whether to enable write lock.

; On a very busy server, whether starting a service or modifying a file,

; can cause a race condition due to multiple processes trying to cache a file at the same time.

; Enable this directive to avoid race conditions.

apc.rfc1867 = off

;sys

; After turning on this directive, for each uploaded file that contains the apc_upload_progress field just before the file field,

; apc will automatically create a user cache entry for upload_ (which is the apc_upload_progress field value).

III. Function:

apc_cache_info - retrieves cached information (and meta-data) from apc's data store

apc_clear_cache - clears the apc cache

apc_define_constants - defines a set of constants for later retrieval and mass-definition

apc_delete - removes a stored variable from the cache

apc_fetch - fetch a stored variable from the cache

apc_load_constants - loads a set of constants from the cache

apc_sma_info - retrieves apc's shared memory allocation information

apc_store - cache a variable in the data store

The usage of apc is relatively simple, with only a few functions, listed below.

apc_cache_info () returns cache information

apc_clear_cache() clears the apc cache content.

By default (no parameters), only the system cache is cleared. To clear the user cache, the ‘user’ parameter is required.

apc_define_constants (string key, array constants [, bool case_sensitive]) Add array constants to the cache as constants.

apc_load_constants (string key).

Remove the constant cache.

apc_store ( string key, mixed var [, int ttl] ).

Save data in cache.

apc_fetch(string key).

Get the cache content saved by apc_store

apc_delete(string key).

Delete the content saved by apc_store.

IV. apc management

Go to pecl.php.net to download the apc source code package, there is apc.php, copy it to a place where your web server can access it, and browse to access it.

Management interface functions include:

1. refresh data

2. view host stats

3. system cache entries

4. user cache entries

5. version check

Pay attention to this tool in Section 4, it is very useful

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478712.htmlTechArticleI. For APC installation configuration, please refer to my article II. Detailed explanation of php.ini configuration item [APC] section [apc] ; alternative php cache is used to cache and optimize php intermediate code apc.cache_by_default = on ;sys ; whether to default...
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 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks 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)

What should I do if Baidu Netdisk is downloaded successfully but cannot be installed? What should I do if Baidu Netdisk is downloaded successfully but cannot be installed? Mar 13, 2024 pm 10:22 PM

If you have successfully downloaded the installation file of Baidu Netdisk, but cannot install it normally, it may be that there is an error in the integrity of the software file or there is a problem with the residual files and registry entries. Let this site take care of it for users. Let’s introduce the analysis of the problem that Baidu Netdisk is successfully downloaded but cannot be installed. Analysis of the problem that Baidu Netdisk downloaded successfully but could not be installed 1. Check the integrity of the installation file: Make sure that the downloaded installation file is complete and not damaged. You can download it again, or try to download the installation file from another trusted source. 2. Turn off anti-virus software and firewall: Some anti-virus software or firewall programs may prevent the installation program from running properly. Try disabling or exiting the anti-virus software and firewall, then re-run the installation

How can I make money by publishing articles on Toutiao today? How to earn more income by publishing articles on Toutiao today! How can I make money by publishing articles on Toutiao today? How to earn more income by publishing articles on Toutiao today! Mar 15, 2024 pm 04:13 PM

1. How can you make money by publishing articles on Toutiao today? How to earn more income by publishing articles on Toutiao today! 1. Activate basic rights and interests: original articles can earn profits by advertising, and videos must be original in horizontal screen mode to earn profits. 2. Activate the rights of 100 fans: if the number of fans reaches 100 fans or above, you can get profits from micro headlines, original Q&A creation and Q&A. 3. Insist on original works: Original works include articles, micro headlines, questions, etc., and are required to be more than 300 words. Please note that if illegally plagiarized works are published as original works, credit points will be deducted, and even any profits will be deducted. 4. Verticality: When writing articles in professional fields, you cannot write articles across fields at will. You will not get appropriate recommendations, you will not be able to achieve the professionalism and refinement of your work, and it will be difficult to attract fans and readers. 5. Activity: high activity,

How to install Android apps on Linux? How to install Android apps on Linux? Mar 19, 2024 am 11:15 AM

Installing Android applications on Linux has always been a concern for many users. Especially for Linux users who like to use Android applications, it is very important to master how to install Android applications on Linux systems. Although running Android applications directly on Linux is not as simple as on the Android platform, by using emulators or third-party tools, we can still happily enjoy Android applications on Linux. The following will introduce how to install Android applications on Linux systems.

Understand Linux Bashrc: functions, configuration and usage Understand Linux Bashrc: functions, configuration and usage Mar 20, 2024 pm 03:30 PM

Understanding Linux Bashrc: Function, Configuration and Usage In Linux systems, Bashrc (BourneAgainShellruncommands) is a very important configuration file, which contains various commands and settings that are automatically run when the system starts. The Bashrc file is usually located in the user's home directory and is a hidden file. Its function is to customize the Bashshell environment for the user. 1. Bashrc function setting environment

How to Install and Run the Ubuntu Notes App on Ubuntu 24.04 How to Install and Run the Ubuntu Notes App on Ubuntu 24.04 Mar 22, 2024 pm 04:40 PM

While studying in high school, some students take very clear and accurate notes, taking more notes than others in the same class. For some, note-taking is a hobby, while for others, it is a necessity when they easily forget small information about anything important. Microsoft's NTFS application is particularly useful for students who wish to save important notes beyond regular lectures. In this article, we will describe the installation of Ubuntu applications on Ubuntu24. Updating the Ubuntu System Before installing the Ubuntu installer, on Ubuntu24 we need to ensure that the newly configured system has been updated. We can use the most famous "a" in Ubuntu system

How to install Podman on Ubuntu 24.04 How to install Podman on Ubuntu 24.04 Mar 22, 2024 am 11:26 AM

If you have used Docker, you must understand daemons, containers, and their functions. A daemon is a service that runs in the background when a container is already in use in any system. Podman is a free management tool for managing and creating containers without relying on any daemon such as Docker. Therefore, it has advantages in managing containers without the need for long-term backend services. Additionally, Podman does not require root-level permissions to be used. This guide discusses in detail how to install Podman on Ubuntu24. To update the system, we first need to update the system and open the Terminal shell of Ubuntu24. During both installation and upgrade processes, we need to use the command line. a simple

Detailed steps to install Go language on Win7 computer Detailed steps to install Go language on Win7 computer Mar 27, 2024 pm 02:00 PM

Detailed steps to install Go language on Win7 computer Go (also known as Golang) is an open source programming language developed by Google. It is simple, efficient and has excellent concurrency performance. It is suitable for the development of cloud services, network applications and back-end systems. . Installing the Go language on a Win7 computer allows you to quickly get started with the language and start writing Go programs. The following will introduce in detail the steps to install the Go language on a Win7 computer, and attach specific code examples. Step 1: Download the Go language installation package and visit the Go official website

Complete guide to install FTPS service on Linux system Complete guide to install FTPS service on Linux system Mar 19, 2024 am 11:39 AM

Title: A complete guide to installing FTPS service under Linux system In Linux system, setting up an FTP server is a common requirement. However, in order to enhance the security of data transmission, we can choose to install the FTPS service, which adds SSL/TLS encryption function based on the FTP protocol. Through the FTPS service, we can upload and download files while ensuring the security of data transmission. This article will provide a detailed guide for installing FTPS service under Linux system and provide specific instructions.

See all articles