{"id":4250,"date":"2014-08-28T12:53:30","date_gmt":"2014-08-28T17:53:30","guid":{"rendered":"https:\/\/secure.rosehosting.com\/blog\/?p=4250"},"modified":"2022-12-08T06:07:20","modified_gmt":"2022-12-08T12:07:20","slug":"how-to-improve-the-performance-of-your-website-with-apc-and-memcached","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/how-to-improve-the-performance-of-your-website-with-apc-and-memcached\/","title":{"rendered":"How to improve the performance of your website with APC and memcached."},"content":{"rendered":"
Today we will show you how to improve the performance of your website with APC and memcached.
\nAPC stands for Alternative PHP Cache and it is an open source solution if you like to speed-up your website. APC caches the output of compiled PHP code and stores the result in shared memory.
\nMemcached on the other hand, stores arbitrary data such as strings and objects that come up as a result from API, database calls etc. It is open source as well and it is intended for improving the\u00a0performance of your website.<\/p>\n
The installation of APC and memcahed is very simple and usually\u00a0takes\u00a010-15 minutes to be completed. This guide will show you how to do that on a Linux VPS<\/a>.<\/p>\n <\/p>\n First thing you need to do is to perform a full system update<\/p>\n Then install the required packages<\/p>\n After\u00a0you have installed \u00a0the required packages,\u00a0you can install APC using PECL<\/p>\n <\/p>\n Once\u00a0the installation is completed you need to add ‘extension=apc.so’ to php.ini. You can use the following command:<\/p>\n And finally, restart the Apache service so the changes can take\u00a0place<\/p>\n To verify that the installation of APC is successful on your CentOS 6 VPS<\/a>, you can create an info.php file<\/p>\n with the following content<\/p>\n <\/p>\n Save the file. To load\u00a0the newly created info.php file you need to open your favorite web browser and type the IP address of your server followed by the name of the file.<\/p>\n That’s it.<\/p>\n <\/p>\n To install memcached you need to run the following command<\/p>\n and the yum package manager will install memcached and all dependencies.<\/p>\n Edit the memcached configuration file, locate the value for OPTIONS and change it to localhost or 127.0.0.1:<\/p>\n Then, run the command<\/p>\n After that, you need to\u00a0add the ‘extension=memcache.so’ to your \/etc\/php.ini file<\/p>\n Next, you can edit the \/etc\/sysconfig\/memcached file in order to configure memcached according to your needs<\/p>\n Now you can restart memcached and Apache<\/p>\n Finally, you can\u00a0verify that memcached is successfully installed on your server by reloading the previously created info.php at<\/p>\n <\/p>\n Of course you don\u2019t have to do any of this if you use one of our Linux VPS Hosting services<\/a>, in which case you can simply ask our expert Linux admins to install APC and memcached\u00a0for you. They are available 24\u00d77 and will take care of your request immediately.<\/p>\n PS<\/span><\/strong>. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.<\/p>\n <\/p>\n","protected":false},"excerpt":{"rendered":" Today we will show you how to improve the performance of your website with APC and memcached. APC stands for … <\/p>\nInstallation of APC<\/h3>\n
## yum update<\/pre>\n
## yum install php-devel pcre-devel php-pear httpd-devel make gcc<\/pre>\n
## pecl install apc<\/pre>\n
## echo \"extension=apc.so\" > \/etc\/php.ini<\/pre>\n
## \/etc\/init.d\/httpd restart<\/pre>\n
## nano \/var\/www\/html\/info.php<\/pre>\n
http:\/\/IP-ADRESS\/info.php<\/pre>\n
Installation of memcached<\/h3>\n
## yum install memcached<\/pre>\n
vi \/etc\/sysconfig\/memcached\r\n\r\nOPTIONS=\"-l 127.0.0.1\"<\/pre>\n
## pecl install memcache<\/pre>\n
## echo \"extension=memcache.so\" >> \/etc\/php.ini<\/pre>\n
## nano \/etc\/sysconfig\/memcached<\/pre>\n
## \/etc\/init.d\/memcached restart\r\n## \/etc\/init.d\/httpd restart<\/pre>\n
http:\/\/IP-ADRESS\/info.php<\/pre>\n