Note : This is a part of http://www.ruchirablog.com/nginx-autoinstaller/ guide.
APC Alternative PHP Cache, is a nice little caching add-on to PHP which can increase the performance of PHP significantly. APC works by optimizing the PHP compiler and storing the final compiled code in the memory. So this saves the burden of having to retrieve the source file from the disk and compile it every time when a visitor requests a page.
So how to install APC on LNMP 0.9 ? Log in to the terminal and just follow the instructions below
Download the APC installation files from the source
Unpack the installer
And start installing
./configure --with-php-config=/usr/local/php/bin/php-config --enable-apc-mmap --enable-apc --enable-apc-filehits
make -s install
After that we need to edit the php.ini file and add apc.so to it
And add the below code to the top of that file
apc.enabled = 1
apc.shm_segments = 1
apc.shm_size = 32
apc.optimization = 1
apc.num_files_hint = 0
apc.ttl = 0
apc.gc_ttl = 3600
apc.cache_by_default = on
It’s done, Now you need to restart php-fpm to start running APC
Congratulations, now you have APC successfully installed. See the code we added to the php.ini file “apc.shm_size = 32″ this is the place that you have to mention the memory limit for APC to operate. 32 means 32mb in this case. 32mb is enough for most cases like wordpress blogs. If you have enough memory on your server you can set this to higher limit such as 128mb. Just change that 32 to 128 and restart php-fpm or lnmp and you are done.
APC comes with a web based page to monitor the APC starts and you can find this on APC-3.1.9/ directory and its called apc.php . Just move apc.php to your domain root directory so you can access it from the browser.
Last 5 posts by Ruchira
- Slotomania Free Slot Games Review - February 24th, 2015
- The Role of Social Media and SEO - October 25th, 2013
- Google announces uProxy to overcome internet censorship - October 22nd, 2013
- Command line bandwidth monitors for Linux - October 21st, 2013
- Problem Kids: When You Know How To Spy On iPhone Remotely, You Worry Less And Focus Better! - August 19th, 2013