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,
- APV 3.1.14 beta
- WAMP server 2.2 containing PHP 5.3.13, Apache 2.2.22 and MySQL 5.5.24
- Windows 7 (64-bit)
Configuration Steps
- At first, I have setup my WAMP Server on a location as E:\wamp.
- 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 - 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.
Now just append following two lines at the very bottom of this initialization file as following figure.
apc.enabled = 1
apc.stat = 1
- Save the file php.ini and close it.
- Now restart the WAMP web server.
- 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\
- 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.