{"id":3631,"date":"2012-07-25T22:37:19","date_gmt":"2012-07-25T14:37:19","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=3631"},"modified":"2023-06-23T16:55:34","modified_gmt":"2023-06-23T16:55:34","slug":"how-to-enable-admin-script-of-apc-on-php","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/how-to-enable-admin-script-of-apc-on-php\/","title":{"rendered":"How to Enable Admin Script of APC on PHP"},"content":{"rendered":"<p>In server administration, optimizing PHP performance is a common task. One effective way to achieve this is by using the Alternative PHP Cache (APC), a robust and open-source framework designed for caching and optimizing PHP intermediate code. APC is a PECL extension, sharing the packaging and distribution system with its sister, PEAR.<\/p>\n<p>This comprehensive guide will walk you through the steps to enable the admin script of APC, building on our previous tutorial on <a href=\"https:\/\/webhostinggeeks.com\/howto\/how-to-enable-apc-with-php-on-centos-6-3\/\">how to enable APC with PHP on CentOS 6.3<\/a>.<\/p>\n<h2>Step 1: Create an APC Directory on Document Root<\/h2>\n<p>First, you need to create a directory named &#8216;apc&#8217; on the document root. This can be done using the following command:<\/p>\n<pre>\r\n[root@centos63 ~]# mkdir \/var\/www\/html\/apc\r\n<\/pre>\n<h2>Step 2: Copy apc.php from php-pecl-apc Folder to Document Root<\/h2>\n<p>Next, copy the &#8216;apc.php&#8217; file from the &#8216;php-pecl-apc&#8217; folder to the document root. Use the command below:<\/p>\n<pre>\r\n[root@centos63 ~]# cp \/usr\/share\/doc\/php-pecl-apc-*\/apc.php \/var\/www\/html\/apc\r\n<\/pre>\n<h2>Step 3: Create a New File Named apc.conf.php<\/h2>\n<p>Now, create a new file named &#8216;apc.conf.php&#8217;. This can be done using the &#8216;vi&#8217; command as shown below:<\/p>\n<pre>\r\n[root@centos63 ~]# vi \/var\/www\/html\/apc\/apc.conf.php\r\n<\/pre>\n<pre>\r\n<?php\r\n   defaults('ADMIN_USERNAME','apcadmin');\r\n# set any username\r\n\r\n   defaults('ADMIN_PASSWORD','apcadmin');\r\n# set any password\r\n\r\n?>\r\n<\/pre>\n<h2>Step 4: Create a New File Named apc.conf<\/h2>\n<p>In this step, create another new file named &#8216;apc.conf&#8217;. Use the following command:<\/p>\n<pre>\r\n[root@centos63 ~]# vi \/etc\/httpd\/conf.d\/apc.conf\r\n<\/pre>\n<pre>\r\n&lt;Directory \/var\/www\/html\/apc&gt;\r\n Order Deny,Allow\r\n Deny from all\r\n Allow from 127.0.0.1 192.168.1.0\/24 \/\/ IP address you allow\r\n&lt;\/Directory&gt;\r\n<\/pre>\n<h2>Step 5: Restart Apache HTTPD<\/h2>\n<p>After creating the necessary files, it&#8217;s time to restart Apache HTTPD. Use the command below:<\/p>\n<pre>\r\n[root@centos63 ~]# \/etc\/rc.d\/init.d\/httpd restart\r\nStopping httpd: [ OK ]\r\nStarting httpd: [ OK ]\r\n<\/pre>\n<h2>Step 6: Navigate to the APC Admin Script<\/h2>\n<p>Finally, navigate your browser to &#8216;http:\/\/servername\/apc\/apc.php&#8217;. The APC admin script should now be enabled and visible.<\/p>\n<p><img decoding=\"async\" data-src=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2012\/07\/APC.png\" alt=\"APC\" width=\"806\" height=\"370\" class=\"alignnone size-full wp-image-16646 img-fluid lazyload\" data-srcset=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2012\/07\/APC.png 806w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2012\/07\/APC-300x138.png 300w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2012\/07\/APC-128x59.png 128w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2012\/07\/APC-420x193.png 420w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2012\/07\/APC-540x248.png 540w, https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2012\/07\/APC-720x331.png 720w\" data-sizes=\"(max-width: 806px) 100vw, 806px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 806px; --smush-placeholder-aspect-ratio: 806\/370;\" \/><\/p>\n<h2>Commands Mentioned<\/h2>\n<ul>\n<li><span class=\"fw-bold\">mkdir \/var\/www\/html\/apc<\/span> \u2013 Creates a new directory named &#8216;apc&#8217; on the document root.<\/li>\n<li><span class=\"fw-bold\">cp \/usr\/share\/doc\/php-pecl-apc-*\/apc.php \/var\/www\/html\/apc<\/span> \u2013 Copies the &#8216;apc.php&#8217; file from the &#8216;php-pecl-apc&#8217; folder to the document root.<\/li>\n<li><span class=\"fw-bold\">vi \/var\/www\/html\/apc\/apc.conf.php<\/span> \u2013 Creates a new file named &#8216;apc.conf.php&#8217; and opens it for editing.<\/li>\n<li><span class=\"fw-bold\">vi \/etc\/httpd\/conf.d\/apc.conf<\/span> \u2013 Creates a new file named &#8216;apc.conf&#8217; and opens it for editing.<\/li>\n<li><span class=\"fw-bold\">\/etc\/rc.d\/init.d\/httpd restart<\/span> \u2013 Restarts the Apache HTTPD service.<\/li>\n<\/ul>\n<h2>Conclusion<\/h2>\n<p>Enabling the admin script of APC is a straightforward process that involves creating and editing a few configuration files, and then restarting the Apache HTTPD service. This guide has provided step-by-step instructions to help you accomplish this task. By following these steps, you can optimize your PHP performance by leveraging the power of APC.<\/p>\n<p>For more information on web server optimization and other related topics, check out our articles on <a href=\"https:\/\/webhostinggeeks.com\/blog\/apache-http-server-explained\/\">Apache<\/a>, <a href=\"https:\/\/webhostinggeeks.com\/blog\/nginx-server-explained\/\">Nginx<\/a>, <a href=\"https:\/\/webhostinggeeks.com\/blog\/litespeed-web-server-explained\/\">LiteSpeed<\/a>, <a href=\"https:\/\/webhostinggeeks.com\/blog\/what-is-dedicated-server-hosting\/\">dedicated server<\/a>, <a href=\"https:\/\/webhostinggeeks.com\/blog\/what-is-vps-hosting\/\">VPS server<\/a>, <a href=\"https:\/\/webhostinggeeks.com\/blog\/what-is-cloud-hosting\/\">cloud hosting<\/a>, and <a href=\"https:\/\/webhostinggeeks.com\/blog\/what-is-shared-hosting\/\">shared hosting<\/a>.<\/p>\n<p>Remember, the key to successful web server administration is continuous learning and adaptation to new technologies and techniques.<\/p>\n<p>Stay informed, stay ahead!<\/p>\n<h2>FAQs<\/h2>\n<ol itemscope itemtype=\"https:\/\/schema.org\/FAQPage\">\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">What is the Alternative PHP Cache (APC)?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">The Alternative PHP Cache (APC) is a free, open, and robust framework for caching and optimizing PHP intermediate code. It is a PECL extension.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">What is the purpose of the &#8216;apc.conf.php&#8217; file?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">The &#8216;apc.conf.php&#8217; file is used to set the username and password for the APC admin script.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">What does the &#8216;apc.conf&#8217; file do?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">The &#8216;apc.conf&#8217; file is used to set the directory permissions for the APC admin script, including which IP addresses are allowed access.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">Why do we need to restart Apache HTTPD?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">Restarting Apache HTTPD ensures that the server recognizes and implements the changes made to the APC configuration.<\/span>\n            <\/p>\n<\/li>\n<li itemscope itemprop=\"mainEntity\" itemtype=\"https:\/\/schema.org\/Question\">\n<p class=\"fw-bold\" itemprop=\"name\">How do I access the APC admin script?<\/p>\n<p itemprop=\"acceptedAnswer\" itemscope itemtype=\"https:\/\/schema.org\/Answer\">\n                <span itemprop=\"text\">You can access the APC admin script by navigating to &#8216;http:\/\/servername\/apc\/apc.php&#8217; in your web browser.<\/span>\n            <\/p>\n<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>In server administration, optimizing PHP performance is a common task. One effective way to achieve this is by using the Alternative PHP Cache (APC), a robust and open-source framework designed&#8230;<\/p>\n","protected":false},"author":6,"featured_media":1262,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[1025],"tags":[1199,1202,1536,1646],"class_list":["post-3631","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php","tag-apache","tag-apc","tag-linux","tag-php"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/3631","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/comments?post=3631"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/3631\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media\/1262"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=3631"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=3631"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=3631"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}