Home > Backend Development > PHP Problem > What does apc mean in php

What does apc mean in php

青灯夜游
Release: 2023-03-15 10:12:02
Original
2939 people have browsed it

In php, apc's full name is "Alternative PHP Cache", which means "Optional PHP Cache" in Chinese. It is an open source cache tool that is effective for PHP and can be used to cache and optimize web servers. PHP code on the server to improve server performance.

What does apc mean in php

The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer

Alternative PHP Cache ( APC) Introduction

Alternative PHP Cache (APC), the full Chinese name is "Optional PHP Cache", is an open source cache tool that is effective for PHP and is an open and free The PHP opcode cache can be used to cache and optimize PHP code on your web server, improving server performance.

Its goal is to provide a free, open and sound framework for caching and optimizing PHP intermediate code to speed up PHP execution.

Advantages of APC

1. Stability

According to our tests on several large sites, although under low load conditions, APC The performance is slightly inferior to eAccelerator, but in the case of long-term operation with large traffic, APC is more stable than eAccelerator. If PHP suddenly freezes and 502 errors appear on your site, we recommend using APC.

2. Technical Support

APC is developing rapidly. Since FACEBOOK added updates to APC, it has developed greatly. However, the new version of eAccelerator is not stable, and its functions and codes have been A lot has been deleted.

3. Compatibility

APC has good support for PHP5.3 version.

Installation configuration:

①: yum install php-apc

in php.ini Just add extension=apc.so inside.

②: Compile and install

Download: http://pecl.php.net/get/APC-3.1.9.tar.gz

tar xvf apc-3.1.9.tar.gz
cd apc-3.1.9
#/usr/bin/phpize (告诉php要动态加载)
#./configure –enable-apc –enable-apc—mmap–with-php-config=/path/to/php/configfile(使用 which php查看)
#make && make install
Copy after login

will apc.so Move to /path/to/php/extension/ and change the file permissions:

#chmod 755 apc.so
Copy after login

Add the apc module to the configuration file

#php –i |grep php.ini First find the php.ini file

# vim php.ini
extension_dir = “./”
extension_dir=”/path/to/php/extension”
Copy after login

Write the apc.so file

extension = apc.so
apc.enabled = 1
apc.cache_by_default = On
apc.shm_segments = 1
apc.shm_size = 128
apc.ttl = 7200
apc.user_ttl = 7200
apc.num_files_hint = 1024
apc.write_lock = On
apc.gc_ttl = 3600
apc.ttl = 0
apc.mmap_file_mask = /tmp/apc.xxxxxx
Copy after login

We combine php with Apache, restart Apache to take effect.

If it is a separate php-fpm, restart php-fpm to take effect.

You can view it in the phpinfo() function, or you can use the command: php –i|grep apc

Recommended learning: "PHP Video Tutorial

The above is the detailed content of What does apc mean in php. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template