Setting up LAMP and PHPUnit on CentOS for staging.

I needing to setup a staging environment that more or less emulates the platform of your deployment system, i needed to setup a LAMP stack with PHPUnit for testing on the target platform.

Using CentOS and help from my good friend Cordoval (you can check out his cutting edge blog at http://www.craftitonline.com) we setup using Apache, PHP and MySQL.

We used the yum package manager to get things up and running:

First we needed to setup php :

and mysql:

With that done, we needed to then setup PEAR:

Then i followed the guides found here: (http://ulaptech.blogspot.co.uk/2011/07/install-phpunit-in-rhel-centos-or.html)

I will copy the instructions but all credit goes to the link above:

1. Make sure that you’re PEAR is version 1.9.2 or above. 

2. Discover all channels required.

3. Install PHPUnit with all the dependencies

<–

optional, at the time of writing this is beta so I had to force install it

4. Done. Test PHPUNIT.

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.

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.

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:

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:

Now we should be able to download and install APC (don’t use the -y option here):

Now we need to create the extensions configs, first we create the ini file we need:

Then edit the file in vi (i would recommend vi over nano/pico as they tend to glitch over ssh)

Now type this into the vi editor (you need to press ‘i’ before you can type):

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.