Alternative PHP Cache (APC)

Source: Internet
Author: User
Tags apc php development environment

Alternative PHP Cache (APC)

Introduction:

Alternative PHP Cache (APC) is an open and free PHP opcode Cache. It aims to provide a free, open, and sound framework for caching and optimizing PHP intermediate code to speed up PHP Execution.

Common PHP accelerators include Eaccelerator and XCache.

: Http://pecl.php.net/get/APC-3.1.9.tgz

1. Install APC

Shell> wget http://pecl.php.net/get/APC-3.1.9.tgz

Shell> tar zxf APC-3.1.9.tgz-C ../
Shell> cd ../APC-3.1.9/

Shell>/usr/local/php/bin/phpize

Shell>./configure \
-- With-php-config =/usr/local/php/bin/php-config \
-- Enable-apc \
-- Enable-apc-mmap \
-- Enable-apc-spinlocks \
-- Disable-apc-pthreadmutex

Shell> make; make install

2. Configure php. ini

Shell & gt; cp/usr/local/php/lib/php/extensions/no-debug-zts-20100525/apc. so/usr/lib64/

Shell> vim/usr/local/php. ini

Extension_dir =/usr/lib64/
Extension = apc. so

[APC]
Apc. enabled = 1 # enable apc
Apc. stat = 1 # Check whether the script is updated every time the script is executed
Apc. shm_segments = 1 # Number of shared memory
Apc. shm_size = 30 M # shared memory size, adjustable according to actual memory
Apc. optimization = 0
Apc. num_files_hint = 0
Apc. ttl = 7200 # cache object lifecycle, in seconds
Apc. user_ttl = 7200 # user cache object Lifecycle
Apc. gc_ttl = 3600
Apc. cache_by_default = on # enable cache for all files

 

# For parameters please refer to the official website: http://php.net/manual/zh/apc.configuration.php

3. Test

Shell>/usr/local/php/bin/php-m | grep apc
Apc

# It indicates that the file has been loaded successfully. You can restart the web to view the phpinfo page.

# An error is reported when you restart php-fpm. It can be started, but an error is reported.

Shell> service php-fpm restart
Gracefully shutting down php-fpm. done
Starting php-fpm/etc/init. d/php-fpm: line 53: 8323 Segmentation fault $ php_fpm_BIN -- daemonize $ php_opts failed

Shell> tail/usr/local/php/var/log/php-fpm.log

[20-Jan-2015 15:43:33] NOTICE: fpm is running, pid 8325
[20-Jan-2015 15:43:33] NOTICE: ready to handle connections

Shell> netstat-anpt | grep php-fpm
Tcp 0 0 127.0.0.1: 9000 0.0.0.0: * LISTEN 8325/php-fpm

# The reason is unknown. Use the following version to replace this version

: Http://pecl.php.net/get/APC-3.1.13.tgz

# The installation method is the same as above. You can simply replace apc. so directly, and no error is reported during restart.

Deep understanding of ini configuration in PHP

Analyze the timeout mechanism of PHP scripts

Build a PHP development environment under Ubuntu 14.04 PDF

PHP 7 innovation and Performance Optimization

PHP 7, you deserve it

Experience PHP 7.0 on CentOS 7.x/Fedora 21

Install LNMP in CentOS 6.3 (PHP 5.4, MyySQL5.6)

Nginx startup failure occurs during LNMP deployment.

Ubuntu install Nginx php5-fpm MySQL (LNMP environment setup)

Detailed php hd scanning PDF + CD source code + full set of teaching videos

Configure the php lnmp development environment in CentOS 6

PHP details: click here
PHP: click here

This article permanently updates the link address:

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.