{"id":1201,"date":"2010-12-18T14:36:13","date_gmt":"2010-12-18T18:36:13","guid":{"rendered":"http:\/\/linuxhostingsupport.net\/blog\/?p=1201"},"modified":"2013-03-20T08:43:57","modified_gmt":"2013-03-20T12:43:57","slug":"how-to-install-and-configure-apc-cache-on-a-centos-server","status":"publish","type":"post","link":"https:\/\/linuxhostingsupport.net\/blog\/how-to-install-and-configure-apc-cache-on-a-centos-server","title":{"rendered":"How to install and configure APC Cache on a CentOS server?"},"content":{"rendered":"<p><strong>APC cache is a PHP caching solution which stands for Alternative PHP Cache.<\/strong> It serves PHP pages from a cache thus helping to reduce server load. APC is an open source software and is updated from time to time.<\/p>\n<p>The following are the steps to install APC cache on a cPanel \/ Plesk OR even on a plan CentOS server:<\/p>\n<p><strong>1)<\/strong> SSH to your server and go to a temporary directory<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"># cd \/usr\/local\/src<\/span><\/pre>\n<\/blockquote>\n<p><strong>2)<\/strong> Download the latest APC version<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"># wget http:\/\/pecl.php.net\/get\/APC-3.1.6.tgz<\/span><\/pre>\n<\/blockquote>\n<p><strong>3)<\/strong> Unpack the version and change to the APC directory<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"># tar -zxf APC-3.1.6.tgz <\/span><\/pre>\n<pre><span style=\"color: #0000ff;\"># cd APC-*<\/span><\/pre>\n<\/blockquote>\n<p><strong>4)<\/strong> Create configuration files<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"># phpize<\/span><\/pre>\n<\/blockquote>\n<p><strong>5)<\/strong> Search for the &#8220;php-config&#8221; file since you need to configure APC with it<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"># which php-config<\/span><\/pre>\n<\/blockquote>\n<p><strong>6)<\/strong> Now, configure APC<\/p>\n<blockquote>\n<pre># .\/configure --enable-apc --enable-apc-mmap --with-apxs\\\r\n --with-php-config=\/usr\/local\/bin\/php-config<\/pre>\n<\/blockquote>\n<p><strong>7)<\/strong> Create the installation files and install APC<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"># make <\/span><\/pre>\n<pre><span style=\"color: #0000ff;\"># make install<\/span><\/pre>\n<\/blockquote>\n<p>Now that the APC cache is installed on your server, the final step is to activate the APC extension in the php.ini file.<\/p>\n<p>Locate the working php.ini file of your server<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"># php -i | grep php.ini<\/span><\/pre>\n<\/blockquote>\n<p>edit the file and search for<strong> &#8220;extension_dir&#8221;<\/strong> and place the following code below it (tweak the values as per your requirement):<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\">extension=\"apc.so\" <\/span><\/pre>\n<pre><span style=\"color: #0000ff;\">apc.enabled=1 <\/span><\/pre>\n<pre><span style=\"color: #0000ff;\">apc.shm_segments=1 <\/span><\/pre>\n<pre><span style=\"color: #0000ff;\">apc.shm_size=256 <\/span><\/pre>\n<pre><span style=\"color: #0000ff;\">apc.ttl=3600 <\/span><\/pre>\n<pre><span style=\"color: #0000ff;\">apc.user_ttl=7200 <\/span><\/pre>\n<pre><span style=\"color: #0000ff;\">apc.num_files_hint=1024 <\/span><\/pre>\n<pre><span style=\"color: #0000ff;\">apc.mmap_file_mask=\/tmp\/apc.XXX <\/span><\/pre>\n<pre><span style=\"color: #0000ff;\">apc.enable_cli=1<\/span><\/pre>\n<\/blockquote>\n<p>Restart the Apache web server\u00a0 for changes to take affect. To confirm if APC is activated, execute<\/p>\n<blockquote>\n<pre><span style=\"color: #0000ff;\"># php -i | grep apc<\/span><\/pre>\n<\/blockquote>\n<p><strong>Note:<\/strong> once APC is installed, make sure the &#8216;apc.so&#8217; file is created under the directory specified at the &#8220;extension_dir&#8221; in php.ini. If not, look for the exact path of the file and create a symlink under it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>APC cache is a PHP caching solution which stands for Alternative PHP Cache. It serves PHP pages from a cache thus helping to reduce server load. APC is an open source software and is updated from time to time.<br \/>\nThe following are the steps to install APC cache on a cPanel \/ Plesk OR even on a plan CentOS server:<br \/>\n1) SSH to your server and go to a temporary directory<\/p>\n<p># cd \/usr\/local\/src<\/p>\n<p>2) Download the latest APC version<\/p>\n<p># wget http:\/\/pecl.php.net\/get\/APC-3.1.6.tgz<\/p>\n<p>3) Unpack the version and change to the APC directory<\/p>\n<p># tar [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1145],"tags":[1147,1150,1148,1151,1146,1149],"_links":{"self":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/1201"}],"collection":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/comments?post=1201"}],"version-history":[{"count":41,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/1201\/revisions"}],"predecessor-version":[{"id":2269,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/posts\/1201\/revisions\/2269"}],"wp:attachment":[{"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/media?parent=1201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/categories?post=1201"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxhostingsupport.net\/blog\/wp-json\/wp\/v2\/tags?post=1201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}