{"id":1732,"date":"2016-05-19T22:40:37","date_gmt":"2016-05-20T04:40:37","guid":{"rendered":"http:\/\/www.supportpro.com\/blog\/?p=1732"},"modified":"2019-10-30T03:36:15","modified_gmt":"2019-10-30T09:36:15","slug":"zend-opcache","status":"publish","type":"post","link":"https:\/\/www.supportpro.com\/blog\/zend-opcache\/","title":{"rendered":"Zend OpCache"},"content":{"rendered":"<p>The <strong>Zend OpCache<\/strong> provides faster PHP execution through opcode caching and optimization. It improves PHP performance by storing precompiled script bytecode in the shared memory.<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Installing Zend OPCache on PHP 5.3 or 5.4<\/strong><\/span><\/p>\n<p>1. Login to SSH on your server<\/p>\n<p>2. Type the following commands:<\/p>\n<p><em>#cd \/usr\/local\/src<\/em><\/p>\n<p><em>#wget http:\/\/pecl.php.net\/get\/ZendOpcache<\/em><\/p>\n<p># to get the latest (master) build do the following instead:<\/p>\n<p><!--more--><\/p>\n<p><em># wget https:\/\/github.com\/zendtech\/ZendOptimizerPlus\/archive\/master.zip<\/em><\/p>\n<p><em>#tar -xvfz ZendOpcache<\/em><\/p>\n<p><em>#cd zendopcache-7.x.x<\/em><\/p>\n<p><em>#phpize<\/em><\/p>\n<p><em>#whereis php-config<\/em><\/p>\n<p># set the path below<\/p>\n<p><em>#.\/configure \u2013with-php-config=\/usr\/local\/bin\/php-config<\/em><\/p>\n<p><em>#make<\/em><\/p>\n<p><em>#make install<\/em><\/p>\n<p>3. Wait for the installation to complete. At the end it will tell you the location it has placed the file opcache.so. Ensure you have this location to your clipboard.<\/p>\n<p>4. Type: <em>vi \/usr\/local\/lib\/php.ini<\/em><\/p>\n<p>5. Scroll down until you find the listing extension_dir = \u201c\/usr\/local\/lib\/php\/extensions\/no-debug-non-zts-XXXXXXXX\u201d<\/p>\n<p>6. Paste this in on a new line (make sure you replace the INSTALL LOCATION with the correct location from step 3):<\/p>\n<p>zend_extension=\/INSTALL LOCATION\/opcache.so<\/p>\n<p>opcache.enable=1<\/p>\n<p>opcache.enable_cli=1<\/p>\n<p>opcache.memory_consumption=128<\/p>\n<p>opcache.interned_strings_buffer=8<\/p>\n<p>opcache.max_accelerated_files=4000<\/p>\n<p>opcache.revalidate_freq=60<\/p>\n<p>opcache.fast_shutdown=1<\/p>\n<p>If xcache is installed, you should also comment all the xcache lines by putting a ; in front of them.<\/p>\n<p>7. Save and exit<\/p>\n<p>8. Type: service httpd restart<\/p>\n<p>9. Type: php -v<\/p>\n<p>10. This should show you that Zend OPcache is enabled.<\/p>\n<p><em>PHP 5.4.3 (cli) (built: Jan 12 2014 20:27:27)&amp;nbsp;<\/em><br \/>\n<em>Copyright (c) 1997-2013 The PHP Group<\/em><br \/>\n<em>Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies<\/em><br \/>\n<em>&amp;nbsp; &amp;nbsp; with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by<\/em><br \/>\n<em>Zend Technologies<\/em><\/p>\n<p>If you require help, <a href=\"https:\/\/www.supportpro.com\/requestquote.php\">contact SupportPRO Server Admin<\/a><\/p>\n<p style=\"text-align: center;\"><!--HubSpot Call-to-Action Code --><span id=\"hs-cta-wrapper-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-wrapper\"><span id=\"hs-cta-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-node hs-cta-9d590242-d641-4383-94b4-8cfd62f0af6b\"><!-- [if lte IE 8]><\/p>\n\n\n\n\n\n<div id=\"hs-cta-ie-element\"><\/div>\n\n\n<![endif]--><a href=\"https:\/\/www.supportpro.com\/freecheckup.php\"><img decoding=\"async\" id=\"hs-cta-img-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-img\" style=\"border-width: 0px;\" src=\"https:\/\/no-cache.hubspot.com\/cta\/default\/2725694\/9d590242-d641-4383-94b4-8cfd62f0af6b.png\" alt=\"Server not running properly? Get A FREE Server Checkup By Expert Server Admins - $125 Value\" \/><\/a><\/span><script charset=\"utf-8\" src=\"https:\/\/js.hscta.net\/cta\/current.js\"><\/script><script type=\"text\/javascript\"> hbspt.cta.load(2725694, '9d590242-d641-4383-94b4-8cfd62f0af6b', {}); <\/script><\/span><!-- end HubSpot Call-to-Action Code --><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Zend OpCache provides faster PHP execution through opcode caching and optimization. It improves PHP performance by storing precompiled script bytecode in the shared memory. Installing Zend OPCache on PHP&hellip;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[5,6,7,3],"tags":[],"class_list":["post-1732","post","type-post","status-publish","format-standard","hentry","category-general-topics","category-linux-basics","category-server-tweaking","category-technical-articles"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/1732","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/comments?post=1732"}],"version-history":[{"count":4,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/1732\/revisions"}],"predecessor-version":[{"id":4413,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/1732\/revisions\/4413"}],"wp:attachment":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/media?parent=1732"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/categories?post=1732"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/tags?post=1732"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}