Install APC (Alternative PHP Cache) in RHEL/CentOS 6/5 & Fedora 20-12

53 篇文章 0 订阅

APC (Alternate PHP Cache) is an free and open source cache for PHP code. The main goal of this module is to provide robust framework for caching and optimizing PHP code.

Install PHP APC in Linux

Install and Enable PHP APC in Linux

The instructions provided here shows how to install and enable APC caching for PHP onRHEL 6.5/6.4/6.3/6.2/6.1/6/5.8/5.6CentOS 6.5/6.4/6.3/6.2/6.1/6/5.8/5.6 and Fedora 20,19,18,17,16,15,14,13,12 using PECL command to download from the repositories.

Install Dependency Packages for APC

First, we need to install required packages called peclphpize and apxs commands, to installAPC using YUM package manager tool.

yum install php-pear php-devel httpd-devel pcre-devel gcc make

Install APC Using PECL

Now we have all the needed packages to install APC. Here we use PECL command to install it. Please select default settings when asked.

pecl install apc
Sample Output :
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
downloading APC-3.1.9.tgz ...
Starting to download APC-3.1.9.tgz (155,540 bytes)
.................................done: 155,540 bytes
54 source files, building
running: phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
config.m4:180: warning: AC_CACHE_VAL(PHP_APC_GCC_ATOMICS, ...): suspicious cache-id, must contain _cv_ to be cached
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:1994: AC_CACHE_CHECK is expanded from...
config.m4:180: the top level
config.m4:180: warning: AC_CACHE_VAL(PHP_APC_GCC_ATOMICS, ...): suspicious cache-id, must contain _cv_ to be cached
../../lib/autoconf/general.m4:1974: AC_CACHE_VAL is expanded from...
../../lib/autoconf/general.m4:1994: AC_CACHE_CHECK is expanded from...
config.m4:180: the top level
Enable internal debugging in APC [no] :
Enable per request file info about files used from the APC cache [no] :
Enable spin locks (EXPERIMENTAL) [no] :
Enable memory protection (EXPERIMENTAL) [no] :
Enable pthread mutexes (default) [yes] :
Enable pthread read/write locks (EXPERIMENTAL) [no] :

Enable APC PHP Extension

Run the following command to enable APC extension in Apache configuration.

echo "extension=apc.so" > /etc/php.d/apc.ini

Restart Apache Service for APC

Restart the Apache service to take new changes.

service httpd restart
OR
/etc/init.d/httpd restart

Verify APC Installation

Create a file phpinfo.php in Apache web root directory. For example/var/www/html/phpinfo.php.

# vi /var/www/html/phpinfo.php

Add the following code to it. save and close.

<?php

// Show all information, defaults to INFO_ALL
phpinfo();

?>

Open any browser and type the following URL. You will see APC enabled configuration similar to below.

http://localhost/phpinfo.php
PHP APC Extension

PHP APC Configuration Screen

Enable PHP APC administration

To enable APC administration panel, copy the following file.

cp /usr/share/pear/apc.php /var/www/html/

Now open the file apc.php with VI editor.

# vi /var/www/html/apc.php

Now set the username and password in the file apc.php as shown below.

defaults('ADMIN_USERNAME','apc');       // Admin Username
defaults('ADMIN_PASSWORD','Set-Password-Here');  // Admin Password - CHANGE THIS TO ENABLE!!!

Type the following URL in the browser. You will get administration panel of APC.

http://localhost/apc.php

Some screenshots of APC Administration panel for your reference.

Vies Host Stats
APC View Host Stats

APC View Host Stats Overview

System Cache Entries
APC System Cache Entries

APC System Cache Entries Overview

User Cache Entries
APC User Cache Entries

APC User Cache Entries Overview

APC Login Screen
APC Admin Login

APC Admin Login Screen

APC Version Check
APC Version Check

APC Version Check Overview

Upgrade APC using PECL

To upgrade, just execute following command it will download and upgrade APC.

pecl upgrade apc

Uninstall APC using PECL

If you like to remove it, then simple type the following command to uninstall APC completely from the system.

pecl uninstall apc
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值