Alternative PHP Cache (APC)

Source: Internet
Author: User
Tags apc configuration php


Brief introduction:

Alternative PHP cache (APC) is an open and free php opcode cache. Its goal is to provide a free, open and robust framework for caching and optimizing PHP's intermediate code to speed up PHP execution.

Common PHP accelerators are eaccelerator, XCache, and so on.

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

1. Installing APC

Shell >wgethttp//pecl.php.net/get/apc-3.1.9.tgzShell>TarZXF apc-3.1.9. tgz-c. /Shell> CD. /apc-3.1.9/Shell>/usr/local/php/bin/Phpizeshell>./Configure--with-php-config=/usr/local/php/bin/php-Config--enable-APC--enable-apc-mmap--enable-apc-spinlocks--disable-apc-Pthreadmutexshell> Make; Make Install

2, Configuration PHP.ini

Shell >CP/usr/local/php/lib/php/extensions/no-debug-zts-20100525/apc.so/usr/lib64/Shell> vim/usr/local/php/Php.iniextension_dir=/usr/lib64/extension=apc.so[apc]apc.enabled=1# enable APCAPC.Stat=1# Checks whether the script is updated every time the script is executed apc.shm_segments=1# Number of shared memory Apc.shm_size=30M # Shared memory size, adjustable according to actual memory apc.optimization=0Apc.num_files_hint=0Apc.ttl=7200# Cache-to-image lifecycle, in seconds Apc.user_ttl=7200# User Cache pair like life cycle Apc.gc_ttl=3600Apc.cache_by_default= on # Enable caching for all files

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

3. Testing

grep APCAPC

# # Description has been loaded successfully, can restart the Web view phpinfo page

# # Restart PHP-FPM error, can start, but will error

Shell > Service php-fpm restartgracefully shutting down PHP-FPM. DoneStarting PHP-fpm/etc/init.d/php-fpm:line -:8323Segmentation fault $php _fpm_bin--daemonize $php _opts Failedshell>Tail/usr/local/php/var/log/php-fpm.log[ --jan- -  the: +: -] NOTICE:FPM is running, PID8325[ --jan- -  the: +: -] Notice:ready to handle Connectionsshell> NETSTAT-ANPT |grepphp-fpmtcp0 0 127.0.0.1:9000 0.0.0.0:* LISTEN8325/php-fpm

# # reason unknown, replace this version with the following version

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

# # Installation method as above, apc.so directly replace can, restart no error

Alternative PHP Cache (APC)

Related Article

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.