Click here to Skip to main content
15,886,766 members
Articles / General Programming / Optimization
Tip/Trick

PHP accelerations: How to configure Alternative PHP Cache (APC) on Windows

Rate me:
Please Sign up or sign in to vote.
5.00/5 (3 votes)
10 Jan 2013CPOL2 min read 26K   4   2
APC is a very popular PHP extension to optimize PHP developments.

Introduction

According to the Wikipedia, accelerations of PHP means to cache the compiled bytecode of PHP scripts to avoid the overhead of parsing and compiling source code on each request. I have used Alternative PHP Cache (APC) to optimize my PHP developments as APC is a fully free and open source (PHP license) framework used for optimizing PHP codes and caches data and compiled code from the PHP bytecode compiler in shared memory.

You may collect the full source of APC from http://pecl.php.net/package/APC.

Occasionally I have been questioned about the procedure to configure APC on Windows platform and the purpose of this submission is how to configure APC on Windows step-by-step avoiding the problems generally found.

Environment  

I have used following versions here to test the complete configuration,

  1. APV 3.1.14 beta 
  2. WAMP server 2.2 containing PHP 5.3.13, Apache 2.2.22 and MySQL 5.5.24
  3. Windows 7 (64-bit) 

Configuration Steps

  1. At first, I have setup my WAMP Server on a location as E:\wamp. 
  2. Now to install APC, I have to copy php_apc.dll to the ext directory. On my system, the location is E:\wamp\bin\php\php5.3.13\ext\

    It's important to excerpt here that you will get the binaries of all versions of APC from the location as
    http://dev.freshsite.p/php-accelerators/apc.html

    As well as, you’ll collect the proper documentation on APC from
    http://www.php.net/manual/en/book.apc.php 
  3. Now open the initialization (php.ini) file from the location as E:\wamp\bin\php\php5.3.13\php.ini or you may follow the way depicted in following figure.
    Image 1

    Now just append following two lines at the very bottom of this initialization file as following figure.
    apc.enabled = 1
    apc.stat = 1

    Image 2
  4. Save the file php.ini and close it.
  5. Now restart the WAMP web server.
  6. Now copy the file apc.php from the archive APC-3.1.14.tgz after extraction, collected from the location http://pecl.php.net/package/APC and paste it to the folder accessible from web server. In my example it is E:\wamp\www\ 
  7. Now open your preferred browser and write on address bar as http://localhost/apc.php and enjoy the environment to improve the performance of your applications developed in PHP.

Conclusion  

As APC is a very popular PHP extension to accelerate PHP development, so you must capable to develop a very large scale of PHP development using it in Windows platform comparing same of Linux/Unix environment.

History

Initial post: 10th January, 2013.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Bangladesh Bangladesh
I have received B.Sc. degree in Computer Science and Engineering from Khulna University of Engineering and Technology, (KUET) Bangladesh in 2003 and Master of Business Administration in Management from University of Dhaka, Bangladesh in 2009. I started my IT career as a Software Engineer at BDCOM Online Limited, then worked for BRAC BDMail Network Limited (bracNet). At present, I am working with Application Development, Integration and Maintenance department of the International Centre for Diarrhoeal Disease Research, Bangladesh (ICDDR,B) - an international health research organization located in Dhaka, Bangladesh, dedicated to saving lives through research and treatment.

Comments and Discussions

 
QuestionNot working Pin
bleuscyther31-Jan-13 10:20
bleuscyther31-Jan-13 10:20 
Questionmissing an l in the url for the dll Pin
bleuscyther31-Jan-13 9:56
bleuscyther31-Jan-13 9:56 
the correct URL: http://dev.freshsite.pl/php-accelerators/apc.html[^] . Missing the l Smile | :) .
Thank you for the post

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.