Installing APC on a server running Plesk
I needed to install APC on a Plesk VPS today, and thought i would share what i did. Following the guide in the blog below i made some additions for a few things that were missing.
Original Guide here.
I also happen to be running CentOS, version 6.
Following the same steps in the linked site, i will add the few that you need that were missed and hopefully this will help anyone else who had the same issues i did with this. (if your like me an impatient you can add -y for most of these to speed up the setup process, it just auto answer yes to any yes/no prompts [mostly do you want to download this? sort of things]).
SSH into your server, preferably with some kind of admin/root access, and then type in the following one at a time.
$ yum install -y php-pear
$ yum install -y php-devel
$ yum install -y httpd-devel
Now we need to install the following as some installations of CentOS don’t have this but you may require it to use some of the PECL extensions.
$ yum install -y pcre-devel
Now chances are being a web server your setup most likely won’t have a dev tool chain, so we need 2 more things before we install APC. We need a compiler and we need a makefile utility (make will do). But first you can check if you have them before going to the extent of downloading something you may not need, to check if you got them:
$ which gcc
$ which make
If any of the 2 above do not show any results and comes back with nothing then you do not have them and need to install them, if your missing just one then install the one your missing. You will need both of them for the next step, if it comes up with a directory then you have it installed. If not we will get them with:
$ yum install -y gcc
$ yum install -y make
Now we should be able to download and install APC (don’t use the -y option here):
$ yum install apc
Now we need to create the extensions configs, first we create the ini file we need:
$ touch /etc/php.d/apc.ini
Then edit the file in vi (i would recommend vi over nano/pico as they tend to glitch over ssh)
$ vi /etc/php.d/apc.ini
Now type this into the vi editor (you need to press ‘i’ before you can type):
extension=apc.so [apc] apc.cache_by_default=0 # disable by default.
So save this file press the escape key and then type :wq and press enter, which should save and quit vi. I choose to disable the cache by default because this setting will apply to all users of your server and it can be a pain if people don’t want it running, they can enable it for themselves in their own directories etc/apc.ini
Lastly we need to restart the http server.
$ service httpd restart
unable to install apc :
^^ I used this command and then moved on:
just one question, got to the end, but how do I verify that it is working?