Install APC (Alternative PHP Cache) in CentOS 5/6/7 and Fedora 20/21

by | 2 Aug 2015 | APC, CentOS, Fedora, Linux, OS, PHP, Programming, Server, Technology | 0 comments

APC (Alternative PHP Cache) is a free and open source tool to cache PHP codes.

phpapc

1. Install Dependency Packages for APC

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

2. Install APC using PECL (PHP Extension Community Library)

pecl install apc

Press “Enter” for the following options

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] :

2a. [Alternative]

If the above command fails, you can use the following method to install APC as well.

yum install php-pecl-apc -y

3. Enable APC PHP Extension

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

4. Restart Apache Service for APC

CentOS

sudo service httpd restart

Fedora

/etc/init.d/httpd restart

5. Verify APC Installation

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

nano /var/www/phpinfo.php

And add the following code to the php file

<?php phpinfo(); ?>

[Optional] If you do not have nano installed

yum install nano

Open the following url in your web browser

http://yourdomain.com/phpinfo.php

Screen Shot 2015-08-02 at 2.48.22 pm

 

6. Enable PHP APC administration

Copy the following file to any web directory that you want. For example, in this case we will copy it to the web root directory.

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

Open the file apc.php 

nano /var/www/html/apc.php

In nano editor, use “Ctrl-w” to search for the username and password field to modify.

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

Open the following link in your web browser.

http://yourdomain.com/apc.php

You should see your APC stats and that’s it!

 

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Related Posts

BrowserGoogle ChromeProgrammingTechnology
[Google Chrome Developer Ti] Prevent Warning "Your connection is not private" from appearing 5
[Google Chrome Developer Tip] Prevent Warning “Your connection is not private” from appearing

[Google Chrome Developer Tip] Prevent Warning “Your connection is not private” from appearing

This is probably more applicable to web developers. Many times when we try to run a localhost site with https in our local environment to emulate the production environment as close as possible, we will always run into a Google Chrome warning message "Your...

AndroidAppleBrowserGoogle ChromeInternet ExplorerLinuxMicrosoft EdgeMobile PhonesMozilla FirefoxOSSafariTechnology
How to do a hard refresh for Chrome, Safari, Firefox, Internet Explorer or Edge in Windows & Mac?

How to do a hard refresh for Chrome, Safari, Firefox, Internet Explorer or Edge in Windows & Mac?

Browser Hard Refresh in Google Chrome, Safari, Mozilla Firefox, Internet Explorer and Microsoft Edge Sometimes just by refreshing your browser alone doesn't help in letting you see the latest changes of a website. Any web developers will know this best. So below...

Amazon Web Services (AWS)Elastic BeanstalkServer
Unable to delete AWS Elastic Beanstalk Environment "resource XX-XXXXXXX has a dependent object" - MervCodes
Unable to delete AWS Elastic Beanstalk Environment “resource XX-XXXXXXX has a dependent object”

Unable to delete AWS Elastic Beanstalk Environment “resource XX-XXXXXXX has a dependent object”

Unable to delete AWS Elastic Beanstalk Environment "resource XX-XXXXXXX has a dependent object" Problem You will usually get this error when you are trying to delete an Elastic Beanstalk environment. Solution As the message in the Events log states, the security...

DatabaseMagentoMySQLOpen SourcePHPPhpMyAdminTechnology
Magento 1.9 Fix for Sending Double Emails or Sending Email to Wrong Recipients

Magento 1.9 Fix for Sending Double Emails or Sending Email to Wrong Recipients

As we know, Magento uses a cron job system to send out email from core_email_queue table. There is an additional table called core_email_queue_recipients, which as the name states, will store all recipients for emails there. But these records do not get removed at...

ApacheCentOSLinuxOSServerTechnology
How to Setup Let's Encrypt FREE SSL Certificate on Centos 6 Apache using Certbot? | MervCodes
How to Setup Let’s Encrypt FREE SSL Certificate on Centos 6 Apache using Certbot?

How to Setup Let’s Encrypt FREE SSL Certificate on Centos 6 Apache using Certbot?

Having SSL on your website these days is important especially if you want your website to rank better on Google search, and that's when Let's Encrypt come into the picture. Let's Encrypt is a free, automated, and open certificate authority (CA), run for the...