{"id":1567,"date":"2013-03-19T08:00:09","date_gmt":"2013-03-19T13:00:09","guid":{"rendered":"http:\/\/www.migrate2cloud.com\/blog\/?p=1567"},"modified":"2016-03-21T02:40:05","modified_gmt":"2016-03-21T07:40:05","slug":"php-caching-the-way-to-speed-up-php-sites","status":"publish","type":"post","link":"https:\/\/www.migrate2cloud.com\/blog\/php-caching-the-way-to-speed-up-php-sites\/","title":{"rendered":"PHP Caching : The way to speed up PHP sites."},"content":{"rendered":"<p dir=\"ltr\">\u00a0\u00a0\u00a0\u00a0 There are many sites which \u00a0is built in PHP. PHP provides the power to simply &#8216;pull&#8217; content from an external source. \u00a0\u00a0it could just as easily be an MySQL database or an XML file etc.<\/p>\n<p dir=\"ltr\">\u00a0\u00a0\u00a0\u00a0The downside to this is processing time, each request for one page can trigger multiple database queries, processing of the output, and formatting it for display. This can be quite slow on complex sites (or slower servers). \u00a0Dynamic sites probably have very little changing content, this page will almost never be updated after the day it is written. Each time someone requests it the scripts goes and fetches the content, applies various functions and filters to it, then outputs it to you<\/p>\n<p dir=\"ltr\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 This is where caching can help us out, instead of regenerating the page every time, the scripts running this site generate it the first time they&#8217;re asked to, then store a copy of what they send back to your browser. The next time a visitor requests the same page, the script will know it&#8217;d already generated one recently, and simply send that to the browser without all the hassle of re-running database queries or searches.<\/p>\n<p dir=\"ltr\"><img decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/HTb_wDgzuniZ_vhA-_60CAhvLatr1XZF4e_LD4AIyqHG-muhwGdZBue47cp1VrOnoGt1_g9K5FzrISzxF9eBAQEIwNfA-oEm8vLazsscy04_j5oTP7-hURw2\" alt=\"\" width=\"698px;\" height=\"592px;\" \/><\/p>\n<p dir=\"ltr\">Different Caching mechanism are discussed below.<\/p>\n<h3><span style=\"color: #008080;\">APC<\/span><\/h3>\n<p dir=\"ltr\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0APC stands for Alternative PHP Cache, and is a free and open opcode cache for PHP. It provides a robust framework for caching and optimizing PHP performance. APC also provides a user cache for storing application data. APC for caches that do not change often and will not grow too big to avoid fragmentation. The default setting of APC will allow you to store 32 MiB for the opcode cache and the user cache combined<\/p>\n<p>Installing apc on ubuntu<\/p>\n<pre><span style=\"color: #808000;\">#apt-get install php-apc<\/span><\/pre>\n<p dir=\"ltr\">edit<span style=\"color: #808000;\"> \u00a0apc.ini <\/span>\u00a0\u00a0; default location on new php5 is &#8211;&gt; \/<span style=\"color: #808000;\">etc\/php5\/conf.d\/20-apc.ini<br \/>\n<\/span><\/p>\n<pre><span style=\"color: #808000;\">extension = apc.so<\/span>; \u00a0uncomment this line<span style=\"color: #808000;\"> \u00a0 \r\napc.shm_segments=1<\/span>;   ( by default its enabled .. give 0 to disable)<\/pre>\n<p dir=\"ltr\">you can customize your values here. for getting the default values install php5-cli and from command line run<\/p>\n<pre><span style=\"color: #808000;\">#php -i | grep apc<\/span><\/pre>\n<p dir=\"ltr\">For monitoring apc cache hits and miss, apc providing a php script. which is located at \/usr\/share\/doc\/php-apc\/apc.php. Copy this file to your document root and you will be able to monitor your apc status.<\/p>\n<p dir=\"ltr\"><a href=\"http:\/\/localhost\/apc.php\">http:\/\/localhost\/apc.php<\/a><\/p>\n<p dir=\"ltr\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/VgJCqTmOpfWRdUKHz4MjfX1lpYpAVze1t6aGTqqTeN4lpLnsrJEmvwL3dhQiRBw7FLl0b7W_Uee8bHF5fyKkziiGdsmeOMWVGudfYXcThIX5A9qD0f9N0_Yb\" alt=\"\" width=\"800px;\" height=\"500px;\" \/><\/p>\n<p dir=\"ltr\">for performance benchmarking we created two php files<\/p>\n<p dir=\"ltr\"><strong>test1.php<\/strong><\/p>\n<pre><span style=\"color: #993366;\">&lt;?php <\/span>\r\n<span style=\"color: #993366;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$start = microtime(true);<\/span>\r\n<span style=\"color: #993366;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0for ($i = 0; $i &lt; 500000; $i++)<\/span>\r\n<span style=\"color: #993366;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 {<\/span>\r\n<span style=\"color: #993366;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0include('test_include.php');<\/span>\r\n<span style=\"color: #993366;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<\/span>\r\n<span style=\"color: #993366;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$end = microtime(true); <\/span><span style=\"color: #993366;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 echo \"Start: \" . $start . \"&lt;br \/&gt;\";<\/span>\r\n<span style=\"color: #993366;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0echo \"End: \" . $end . \"&lt;br \/&gt;\";<\/span>\r\n<span style=\"color: #993366;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0echo \"Diff: \". ($end-$start) . \"&lt;br \/&gt;\";<\/span>\r\n<span style=\"color: #993366;\">?&gt;<\/span><\/pre>\n<p dir=\"ltr\"><strong>test2.php<\/strong><\/p>\n<pre><span style=\"color: #993366;\">&lt;?php<\/span>\r\n<span style=\"color: #993366;\"> \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $t = \u00a0\u00a0\u00a0\"migrate2cloud\";<\/span>\r\n<span style=\"color: #993366;\"> ?&gt;<\/span><\/pre>\n<p dir=\"ltr\">Without apc&#8230;<\/p>\n<pre><span style=\"color: #808000;\">Start: 1360937874.8965 \r\nEnd: 1360937883.1506 \r\nDiff: 8.2541239261627<\/span><\/pre>\n<p dir=\"ltr\">With apc..<\/p>\n<pre><span style=\"color: #808000;\">Start: 1360937935.5746 \r\nEnd: 1360937936.7291 \r\nDiff: 1.1545231342316<\/span><\/pre>\n<p dir=\"ltr\">\u00a0without apc it took <strong>8<\/strong> seconds to complete the request .. with apc.. <strong>1.15<\/strong> seconds..<\/p>\n<h3 id=\"internal-source-marker_0.42656557955378216\"><span style=\"color: #008080;\">Memcached<\/span><\/h3>\n<p dir=\"ltr\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Memcached system uses a client\u2013server architecture. The servers maintain a key\u2013value associative array; the clients populate this array and query it. Keys are up to 250 bytes long and values can be at most 1 megabyte in size. Clients use client-side libraries to contact the servers which, by default, expose their service at port 11211. Amazon provides a Service called Amazon elasticache for memcache through which we can configure memcache clusters for caching purposes.<\/p>\n<p dir=\"ltr\">installation and configuration<\/p>\n<pre><span style=\"color: #808000;\">apt-get install memcached \r\napt-get install php5-memcached<\/span><\/pre>\n<p dir=\"ltr\">enable memcache module in <span style=\"color: #808000;\">\/etc\/php5\/apache2\/conf.d\/20-memcached.ini<\/span> \u00a0or in <span style=\"color: #808000;\">php.ini<\/span><\/p>\n<pre><span style=\"color: #808000;\"><span style=\"color: #800080;\">edit php.ini<\/span> \r\nsession.save_handler = memcached \r\nextension=memcache.so\r\nextension=memcached.so<\/span><\/pre>\n<p dir=\"ltr\">Restart apache and memcache..<\/p>\n<p dir=\"ltr\">php script used for memcache testing..<\/p>\n<pre>\u00a0\r\n<span style=\"color: #800080;\">&lt;?php<\/span>\r\n<span style=\"color: #800080;\">\/\/memcached simple test \u00a0<\/span>\r\n<span style=\"color: #800080;\">$memcache = new Memcache;<\/span>\r\n<span style=\"color: #800080;\">$memcache-&gt;connect('localhost', 11211) or die (\"Could not connect\");<\/span>\r\n<span style=\"color: #800080;\">$key = md5('42data'); \u00a0\/\/something unique \u00a0<\/span>\r\n<span style=\"color: #800080;\">for ($k=0; $k&lt;5; $k++) {<\/span>\r\n<span style=\"color: #800080;\">$data = $memcache-&gt;get($key);<\/span>\r\n<span style=\"color: #800080;\">\u00a0\u00a0\u00a0 if ($data == NULL) {<\/span>\r\n<span style=\"color: #800080;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $data = array();<\/span>\r\n<span style=\"color: #800080;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \/\/generate an array of random shit \u00a0<\/span>\r\n<span style=\"color: #800080;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 echo \"expensive query\";<\/span>\r\n<span style=\"color: #800080;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 for ($i=0; $i&lt;100; $i++) {<\/span>\r\n<span style=\"color: #800080;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 for ($j=0; $j&lt;10; $j++) {<\/span>\r\n<span style=\"color: #800080;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $data[$i][$j] = 42; \u00a0\/\/who cares \u00a0<\/span>\r\n<span style=\"color: #800080;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<\/span>\r\n<span style=\"color: #800080;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 }<\/span>\r\n<span style=\"color: #800080;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 $memcache-&gt;set($key,$data,0,3600);<\/span>\r\n<span style=\"color: #800080;\">\u00a0\u00a0\u00a0 } else <\/span>\r\n<span style=\"color: #800080;\"> {<\/span>\r\n<span style=\"color: #800080;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 echo \"cached\";<\/span>\r\n<span style=\"color: #800080;\">\u00a0\u00a0\u00a0 }<\/span><span style=\"color: #800080;\"> \u00a0} <\/span><\/pre>\n<p dir=\"ltr\">You can monitor memcache using phpmemcacheadmin<\/p>\n<p dir=\"ltr\"><a href=\"http:\/\/code.google.com\/p\/phpmemcacheadmin\/\">http:\/\/code.google.com\/p\/phpmemcacheadmin\/<\/a><\/p>\n<p dir=\"ltr\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/1AbvvlvtYEM7z2LjIpNTqZxZ046bZMUAKocbaoc4Qd1gfcOiLmQ340Ai3RisBy9uRU6focfa9S9KtWhFxQdklEdtHLe43eo7JX9KmkO1ssQcgaqkWAeEAJPp\" alt=\"\" width=\"698px;\" height=\"436px;\" \/><\/p>\n<h3 id=\"internal-source-marker_0.42656557955378216\"><span style=\"color: #339966;\">Varnish &#8211; Cache<\/span><\/h3>\n<p>Varnish has a concept of &#8220;backend&#8221; or &#8220;origin&#8221; servers. A backend server is the server providing the content Varnish will accelerate. Our first task is to tell Varnish where it can find its content. open the varnish default configuration file. Iif you installed from a package it is probably \/etc\/varnish\/default.vcl.<\/p>\n<p>Somewhere in the top there will be a section that looks a bit like this.:<\/p>\n<pre><span style=\"color: #808000;\">backend default { .host = \"127.0.0.1\"; .port = \"80\"; }<\/span><\/pre>\n<p>Change the port number to your apache ( or whatever the webserver you are using) port number.<\/p>\n<p>this piece of configuration defines a backend in Varnish called default. When Varnish needs to get content from this backend it will connect to port 80 on localhost (127.0.0.1).<\/p>\n<pre><span style=\"color: #808000;\"># varnishd -f \/etc\/varnish\/default.vcl -s malloc,1G -T 127.0.0.1:2000 -a 0.0.0.0:80<\/span><\/pre>\n<p>The -f options specifies what configuration varnishd should use.<\/p>\n<p>The -s options chooses the storage type Varnish should use for storing its content<\/p>\n<p>-T 127.0.0.1:2000 &#8212; Varnish has a built-in text-based administration interface<\/p>\n<p>-a 0.0.0.0:80 &#8212; specify that I want Varnish to listen on port 80<\/p>\n<p>For logging varnish &#8212; In terminal window you started varnish type varnishlog<\/p>\n<p>When someone accessing your page you will get log like<\/p>\n<pre><span style=\"color: #808000;\">#varnishlog<\/span>\r\n<span style=\"color: #800080;\">11 SessionOpen c 127.0.0.1 58912 0.0.0.0:80 \r\n11 ReqStart c 127.0.0.1 58912 595005213 \r\n11 RxRequest c GET \r\n11 RxURL c \/ \r\n11 RxProtocol c HTTP\/1.1 \r\n11 RxHeader c Host: localhost:80\r\n11 RxHeader c Connection: keep-alive<\/span><\/pre>\n<h3><span style=\"color: #008000;\">Where not to use Caching<\/span><\/h3>\n<p style=\"text-align: justify;\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Caching should not be used for some things like search results, forums etc&#8230; where the content has to be upto the times and changes depending on user&#8217;s input. It&#8217;s also advisable to avoid using this method for things like a Flash news page, in general dont use it on any page that you wouldn&#8217;t want the end users browser or proxy to cache.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u00a0\u00a0\u00a0\u00a0 There are many sites which \u00a0is built in PHP. PHP provides the power to simply &#8216;pull&#8217; content from an external source. \u00a0\u00a0it could just as easily be an MySQL database or an XML file etc. \u00a0\u00a0\u00a0\u00a0The downside to this is processing time, each request for one page can trigger multiple database queries, processing of [&hellip;]<\/p>\n","protected":false},"author":17,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[132],"tags":[135,140,123,141,144,143,133,137,139,116,24,122,134,142,136,138],"class_list":["post-1567","post","type-post","status-publish","format-standard","hentry","category-hosting","tag-appfabric-caching","tag-backend-server","tag-cache","tag-caching","tag-company-amazon-com","tag-company-mysql-ab","tag-cross-platform-software","tag-department-stores-nec","tag-flash","tag-http","tag-memcached","tag-optimization","tag-php","tag-search-results","tag-technologyinternet","tag-xml"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"There are many sites which is built in PHP. PHP provides the power to simply &#039;pull&#039; content from an external source. it could just as easily be an MySQL database or an XML file etc. The downside to this is processing time, each request for one page can trigger multiple database queries, processing of\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"admin\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.migrate2cloud.com\/blog\/php-caching-the-way-to-speed-up-php-sites\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Migrate to Cloud - we make the clouds rain\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"PHP Caching : The way to speed up PHP sites. - Migrate to Cloud\" \/>\n\t\t<meta property=\"og:description\" content=\"There are many sites which is built in PHP. PHP provides the power to simply &#039;pull&#039; content from an external source. it could just as easily be an MySQL database or an XML file etc. The downside to this is processing time, each request for one page can trigger multiple database queries, processing of\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.migrate2cloud.com\/blog\/php-caching-the-way-to-speed-up-php-sites\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2013-03-19T13:00:09+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2016-03-21T07:40:05+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"PHP Caching : The way to speed up PHP sites. - Migrate to Cloud\" \/>\n\t\t<meta name=\"twitter:description\" content=\"There are many sites which is built in PHP. PHP provides the power to simply &#039;pull&#039; content from an external source. it could just as easily be an MySQL database or an XML file etc. The downside to this is processing time, each request for one page can trigger multiple database queries, processing of\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/www.migrate2cloud.com\\\/blog\\\/php-caching-the-way-to-speed-up-php-sites\\\/#blogposting\",\"name\":\"PHP Caching : The way to speed up PHP sites. - Migrate to Cloud\",\"headline\":\"PHP Caching : The way to speed up PHP sites.\",\"author\":{\"@id\":\"https:\\\/\\\/www.migrate2cloud.com\\\/blog\\\/author\\\/admin-2\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.migrate2cloud.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/lh4.googleusercontent.com\\\/HTb_wDgzuniZ_vhA-_60CAhvLatr1XZF4e_LD4AIyqHG-muhwGdZBue47cp1VrOnoGt1_g9K5FzrISzxF9eBAQEIwNfA-oEm8vLazsscy04_j5oTP7-hURw2\",\"@id\":\"https:\\\/\\\/www.migrate2cloud.com\\\/blog\\\/php-caching-the-way-to-speed-up-php-sites\\\/#articleImage\"},\"datePublished\":\"2013-03-19T08:00:09-05:00\",\"dateModified\":\"2016-03-21T02:40:05-05:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.migrate2cloud.com\\\/blog\\\/php-caching-the-way-to-speed-up-php-sites\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.migrate2cloud.com\\\/blog\\\/php-caching-the-way-to-speed-up-php-sites\\\/#webpage\"},\"articleSection\":\"hosting, AppFabric Caching, backend server, cache, caching, Company: Amazon.com, Company: MySQL AB, Cross-platform software, Department Stores - NEC, Flash, HTTP, memcached, optimization, PHP, search results, Technology\\\/Internet, XML\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.migrate2cloud.com\\\/blog\\\/php-caching-the-way-to-speed-up-php-sites\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.migrate2cloud.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.migrate2cloud.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.migrate2cloud.com\\\/blog\\\/category\\\/hosting\\\/#listItem\",\"name\":\"hosting\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.migrate2cloud.com\\\/blog\\\/category\\\/hosting\\\/#listItem\",\"position\":2,\"name\":\"hosting\",\"item\":\"https:\\\/\\\/www.migrate2cloud.com\\\/blog\\\/category\\\/hosting\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.migrate2cloud.com\\\/blog\\\/php-caching-the-way-to-speed-up-php-sites\\\/#listItem\",\"name\":\"PHP Caching : The way to speed up PHP sites.\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.migrate2cloud.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.migrate2cloud.com\\\/blog\\\/php-caching-the-way-to-speed-up-php-sites\\\/#listItem\",\"position\":3,\"name\":\"PHP Caching : The way to speed up PHP sites.\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.migrate2cloud.com\\\/blog\\\/category\\\/hosting\\\/#listItem\",\"name\":\"hosting\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.migrate2cloud.com\\\/blog\\\/#organization\",\"name\":\"Migrate to Cloud\",\"description\":\"we make the clouds rain\",\"url\":\"https:\\\/\\\/www.migrate2cloud.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.migrate2cloud.com\\\/blog\\\/author\\\/admin-2\\\/#author\",\"url\":\"https:\\\/\\\/www.migrate2cloud.com\\\/blog\\\/author\\\/admin-2\\\/\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.migrate2cloud.com\\\/blog\\\/php-caching-the-way-to-speed-up-php-sites\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d370c5f82d8ed54ea2a14d7d135705e3add3103f5fa9b7670bd9dc6335a92e9e?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"admin\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.migrate2cloud.com\\\/blog\\\/php-caching-the-way-to-speed-up-php-sites\\\/#webpage\",\"url\":\"https:\\\/\\\/www.migrate2cloud.com\\\/blog\\\/php-caching-the-way-to-speed-up-php-sites\\\/\",\"name\":\"PHP Caching : The way to speed up PHP sites. - Migrate to Cloud\",\"description\":\"There are many sites which is built in PHP. PHP provides the power to simply 'pull' content from an external source. it could just as easily be an MySQL database or an XML file etc. The downside to this is processing time, each request for one page can trigger multiple database queries, processing of\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.migrate2cloud.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.migrate2cloud.com\\\/blog\\\/php-caching-the-way-to-speed-up-php-sites\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.migrate2cloud.com\\\/blog\\\/author\\\/admin-2\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.migrate2cloud.com\\\/blog\\\/author\\\/admin-2\\\/#author\"},\"datePublished\":\"2013-03-19T08:00:09-05:00\",\"dateModified\":\"2016-03-21T02:40:05-05:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.migrate2cloud.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.migrate2cloud.com\\\/blog\\\/\",\"name\":\"Migrate to Cloud\",\"description\":\"we make the clouds rain\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.migrate2cloud.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"PHP Caching : The way to speed up PHP sites. - Migrate to Cloud","description":"There are many sites which is built in PHP. PHP provides the power to simply 'pull' content from an external source. it could just as easily be an MySQL database or an XML file etc. The downside to this is processing time, each request for one page can trigger multiple database queries, processing of","canonical_url":"https:\/\/www.migrate2cloud.com\/blog\/php-caching-the-way-to-speed-up-php-sites\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/www.migrate2cloud.com\/blog\/php-caching-the-way-to-speed-up-php-sites\/#blogposting","name":"PHP Caching : The way to speed up PHP sites. - Migrate to Cloud","headline":"PHP Caching : The way to speed up PHP sites.","author":{"@id":"https:\/\/www.migrate2cloud.com\/blog\/author\/admin-2\/#author"},"publisher":{"@id":"https:\/\/www.migrate2cloud.com\/blog\/#organization"},"image":{"@type":"ImageObject","url":"https:\/\/lh4.googleusercontent.com\/HTb_wDgzuniZ_vhA-_60CAhvLatr1XZF4e_LD4AIyqHG-muhwGdZBue47cp1VrOnoGt1_g9K5FzrISzxF9eBAQEIwNfA-oEm8vLazsscy04_j5oTP7-hURw2","@id":"https:\/\/www.migrate2cloud.com\/blog\/php-caching-the-way-to-speed-up-php-sites\/#articleImage"},"datePublished":"2013-03-19T08:00:09-05:00","dateModified":"2016-03-21T02:40:05-05:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/www.migrate2cloud.com\/blog\/php-caching-the-way-to-speed-up-php-sites\/#webpage"},"isPartOf":{"@id":"https:\/\/www.migrate2cloud.com\/blog\/php-caching-the-way-to-speed-up-php-sites\/#webpage"},"articleSection":"hosting, AppFabric Caching, backend server, cache, caching, Company: Amazon.com, Company: MySQL AB, Cross-platform software, Department Stores - NEC, Flash, HTTP, memcached, optimization, PHP, search results, Technology\/Internet, XML"},{"@type":"BreadcrumbList","@id":"https:\/\/www.migrate2cloud.com\/blog\/php-caching-the-way-to-speed-up-php-sites\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.migrate2cloud.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/www.migrate2cloud.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/www.migrate2cloud.com\/blog\/category\/hosting\/#listItem","name":"hosting"}},{"@type":"ListItem","@id":"https:\/\/www.migrate2cloud.com\/blog\/category\/hosting\/#listItem","position":2,"name":"hosting","item":"https:\/\/www.migrate2cloud.com\/blog\/category\/hosting\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.migrate2cloud.com\/blog\/php-caching-the-way-to-speed-up-php-sites\/#listItem","name":"PHP Caching : The way to speed up PHP sites."},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.migrate2cloud.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/www.migrate2cloud.com\/blog\/php-caching-the-way-to-speed-up-php-sites\/#listItem","position":3,"name":"PHP Caching : The way to speed up PHP sites.","previousItem":{"@type":"ListItem","@id":"https:\/\/www.migrate2cloud.com\/blog\/category\/hosting\/#listItem","name":"hosting"}}]},{"@type":"Organization","@id":"https:\/\/www.migrate2cloud.com\/blog\/#organization","name":"Migrate to Cloud","description":"we make the clouds rain","url":"https:\/\/www.migrate2cloud.com\/blog\/"},{"@type":"Person","@id":"https:\/\/www.migrate2cloud.com\/blog\/author\/admin-2\/#author","url":"https:\/\/www.migrate2cloud.com\/blog\/author\/admin-2\/","name":"admin","image":{"@type":"ImageObject","@id":"https:\/\/www.migrate2cloud.com\/blog\/php-caching-the-way-to-speed-up-php-sites\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/d370c5f82d8ed54ea2a14d7d135705e3add3103f5fa9b7670bd9dc6335a92e9e?s=96&d=mm&r=g","width":96,"height":96,"caption":"admin"}},{"@type":"WebPage","@id":"https:\/\/www.migrate2cloud.com\/blog\/php-caching-the-way-to-speed-up-php-sites\/#webpage","url":"https:\/\/www.migrate2cloud.com\/blog\/php-caching-the-way-to-speed-up-php-sites\/","name":"PHP Caching : The way to speed up PHP sites. - Migrate to Cloud","description":"There are many sites which is built in PHP. PHP provides the power to simply 'pull' content from an external source. it could just as easily be an MySQL database or an XML file etc. The downside to this is processing time, each request for one page can trigger multiple database queries, processing of","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/www.migrate2cloud.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/www.migrate2cloud.com\/blog\/php-caching-the-way-to-speed-up-php-sites\/#breadcrumblist"},"author":{"@id":"https:\/\/www.migrate2cloud.com\/blog\/author\/admin-2\/#author"},"creator":{"@id":"https:\/\/www.migrate2cloud.com\/blog\/author\/admin-2\/#author"},"datePublished":"2013-03-19T08:00:09-05:00","dateModified":"2016-03-21T02:40:05-05:00"},{"@type":"WebSite","@id":"https:\/\/www.migrate2cloud.com\/blog\/#website","url":"https:\/\/www.migrate2cloud.com\/blog\/","name":"Migrate to Cloud","description":"we make the clouds rain","inLanguage":"en-US","publisher":{"@id":"https:\/\/www.migrate2cloud.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"Migrate to Cloud - we make the clouds rain","og:type":"article","og:title":"PHP Caching : The way to speed up PHP sites. - Migrate to Cloud","og:description":"There are many sites which is built in PHP. PHP provides the power to simply 'pull' content from an external source. it could just as easily be an MySQL database or an XML file etc. The downside to this is processing time, each request for one page can trigger multiple database queries, processing of","og:url":"https:\/\/www.migrate2cloud.com\/blog\/php-caching-the-way-to-speed-up-php-sites\/","article:published_time":"2013-03-19T13:00:09+00:00","article:modified_time":"2016-03-21T07:40:05+00:00","twitter:card":"summary_large_image","twitter:title":"PHP Caching : The way to speed up PHP sites. - Migrate to Cloud","twitter:description":"There are many sites which is built in PHP. PHP provides the power to simply 'pull' content from an external source. it could just as easily be an MySQL database or an XML file etc. The downside to this is processing time, each request for one page can trigger multiple database queries, processing of"},"aioseo_meta_data":{"post_id":"1567","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"created":"2022-12-27 09:26:05","updated":"2026-07-21 15:32:12","ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.migrate2cloud.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.migrate2cloud.com\/blog\/category\/hosting\/\" title=\"hosting\">hosting<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tPHP Caching : The way to speed up PHP sites.\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.migrate2cloud.com\/blog"},{"label":"hosting","link":"https:\/\/www.migrate2cloud.com\/blog\/category\/hosting\/"},{"label":"PHP Caching : The way to speed up PHP sites.","link":"https:\/\/www.migrate2cloud.com\/blog\/php-caching-the-way-to-speed-up-php-sites\/"}],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.migrate2cloud.com\/blog\/wp-json\/wp\/v2\/posts\/1567","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.migrate2cloud.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.migrate2cloud.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.migrate2cloud.com\/blog\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/www.migrate2cloud.com\/blog\/wp-json\/wp\/v2\/comments?post=1567"}],"version-history":[{"count":46,"href":"https:\/\/www.migrate2cloud.com\/blog\/wp-json\/wp\/v2\/posts\/1567\/revisions"}],"predecessor-version":[{"id":2123,"href":"https:\/\/www.migrate2cloud.com\/blog\/wp-json\/wp\/v2\/posts\/1567\/revisions\/2123"}],"wp:attachment":[{"href":"https:\/\/www.migrate2cloud.com\/blog\/wp-json\/wp\/v2\/media?parent=1567"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.migrate2cloud.com\/blog\/wp-json\/wp\/v2\/categories?post=1567"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.migrate2cloud.com\/blog\/wp-json\/wp\/v2\/tags?post=1567"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}