Quickly Deploy LAMP Stacks with ServerPilot

Easily Deploy LAMP Stacks, and it’s free

I have yet to use ServerPilot, but will be setting up a new VPS at DigitalOcean in the coming weeks for a new venture. ServerPilot makes getting a LAMP stack setup very quickly.

ServerPilot will automatically install Nginx, Apache, PHP, and MySQL on a new, freshly installed/created, 64-bit Ubuntu 12.04 or Ubuntu 14.04. So if you’re using DigitalOcean, create your Droplet, and SSH to it. You should be able to harden SSH up a little, but make sure you don’t install any new packages yet.

Getting Started

Getting started with ServerPilot is crazy easy. All you need to be able to do is SSH into your server and run a command. I highly doubt anyone reading this doesn’t know how to do this. If you don’t, Google will tell you how.

1. Sign Up

Sign up for a free account with ServerPilot.

2. Connect A Server

“Connect” a new server. Just enter your servers hostname and click the “Continue With Setup” button. Screenshot below.

3. Run The Install

Connect to your server via SSH. Remember, it must be a new server, preferably with no additional packages installed yet. To install Nginx, Apache, PHP, and MySQL, run the command below, from this gist:

The --server-id and --server-apikey values will be provided for you, they’re blacked out in the screenshot below.

Additional Information

On GitHub

ServerPilot also has a GitHub account with two repositories currently. One is ServerPilot/Vagrantfile and the other is ServerPilot/API.


This repository provides a sample Vagrant configuration for testing ServerPilot. Basically a server that you can use to test ServerPilot before using it on a new, paid VPS. The README is very detailed, definitely read it if you need help using Vagrant. There’s even an example on using composer to create a Laravel app.


From the README, The ServerPilot API is RESTful and allows you to manage ServerPilot resources using HTTP requests. All responses return JSON objects, including errors. As seems typical from ServerPilot, the documentation in the README is excellent.

The API will let you do things like list servers, connect new servers, or list all system users, among many others. An example that would list all servers can be seen in the gist below.

That request would return JSON similar to this:

Do you use Vagrant?

View Results

Loading ... Loading ...

Paid Accounts

You get a pretty cool monitoring dashboard for $10/month. I found the screenshot below in a post from Jake Peterson, it appears to be the ServerPilot monitoring dashboard.
There’s the free plan, obviously, and then two paid plans. One is $10/month and the other is $49/month. You can see what you get for your money on their pricing page.


If you’re a PHP developer and use a VPS provider like DigitalOcean or Linode, ServerPilot is probably worth checking out. Even if you don’t end up using, it’s pretty neat that something like this even exists.

I only have one feature I’d really like to see, the ability to select certain packages to be installed. If that were included in the $10/month plan, I’d definitely do it. As it stands currently, though, it’s definitely a time saver and very well executed.


MySQL Workbench on Debian Squeeze 6.0.6

MySQL Workbench on Debian Squeeze 6.0.6

I spent about an hour compiling MySQL Workbench from source earlier today. After about 20 newly satisfied dependencies and an hour of actual building, I fired it up and discovered I wasn’t able to connect to any MySQL server through an SSH tunnel, which I have to be able to do.

I was able to find a deb package, mysql-workbench-gpl-5.2.39-1ubu1004-i386.deb, that seems to work quite well on Debian Squeeze 6.0.6. The package was mentioned in this forum post at debian.net. The package itself was the MySQL-provided deb for Ubuntu 10.04.

After I installed that deb, MySQL Workbench was able to connect to a MySQL server through an SSH tunnel. I must, must remember this for future Debian Squeeze installs.


How To: Build a Tag Cloud with PHP, MySQL, and CSS

Tag clouds are everywhere. They are a popular way to show the weight (read: popularity) of tags, categories, or any words really. I needed to build a tag cloud for a project at work to display categories and show how many questions were contained inside each category. Categories with more questions would need a larger font, and categories with fewer questions would need smaller fonts. I came across this post from Steve Thomas titled How to make a tag cloud in PHP, MySQL and CSS.

Steve’s code is exactly what I was looking for. I made a few modifications to his code and wrapped it all into a custom PHP function, which you can see below.

Download The Code

The function returns an array that contains each category name, the CSS class that should be applied to the given category, and the category ID for linking to the page showing only questions in that category.

function tagCloud($maximum=0) {
	$cats = array(); // create empty array
	$query = mysql_query("SELECT categories.catDesc, categories.catId, COUNT( questions.id ) AS totalQuestions FROM questions, categories WHERE questions.categoryId = categories.catId GROUP BY categories.catId;");
	while ($row = mysql_fetch_array($query)) {
		$cat = $row['catDesc'];
		$counter = $row['totalQuestions'];
		$catid = $row['catID'];

		// update $maximum if this term is more popular than the previous terms
		if ($counter> $maximum) $maximum = $counter;
		$percent = floor(($counter / $maximum) * 100);
		if ($percent <20) {
			$class = 'smallest';
		elseif ($percent>= 20 and $percent <40) {
			$class = 'small';
		elseif ($percent>= 40 and $percent <60) {
			$class = 'medium';
		elseif ($percent>= 60 and $percent <80) {
			$class = 'large';
		else {
			$class = 'largest';
		$cats[] = array('term' => $cat, 'class' => $class, 'catid' => $catid);

	return $cats;

You’ll also need some CSS to style your tag cloud. This CSS is pretty much identical to what Steve published, I only made some minor changes to font sizes.

#tagcloud {
    width: 300px;
    padding: 10px;
    border: 1px solid #FFE7B6;
#tagcloud a:link, #tagcloud a:visited {
#tagcloud a:hover, #tagcloud a:active {
    text-decoration: underline;
    color: #000;
#tagcloud span {
    padding: 4px;
.smallest {
    font-size: 10px;
.small {
    font-size: 12px;
.medium {
.large {
.largest {

To use the function, do something like this:

$tagCloud = tagCloud();
foreach ($tagCloud as $t) {
	$cat = $t['term'];
	$class = $t['class'];
	$catid = $t['catid'];
	print "<span class="$class"><a href="category.php?id=$catid">$cat</a></span>";

I am still testing this code, but so far it seems to do exactly what I need it to do. It’s best to use tagclouds in a virtual private server provider that supports PHP, MySQL and CSS. If you experience trouble with the code or if it doesn’t act as expected, please let me know in the comments. If you’ve got ideas on how to improve the function, I’d love to hear your thoughts as well!


MySQL Cheatsheet By Example

Tech-Evangelist has put together an excellent cheatsheet for MySQL. There’s lots of other MySQL cheatsheets out there, but this one is unique in the fact that it gives examples of usage rather than just snippets of code.

This cheatsheet also includes a summary of commonly used MySQL data types, which will be really helpful to me. I can’t tell you how many times in a week I hit the MySQL website looking for specs on a certain data type.

If you think this cheatsheet would be useful to you, head on over to Tech-Evangelist to download the PDF.


MySQL Is Huge

Take note of this graphic. Notice there’s been 3,775,826 queries processed by that MySQL server in a little more than 5 days. Nothing too impressive right? Right.
Lots of Queries

We know MySQL can handle many more queries than that in a much shorter period of time. What amazes me is how well MySQL performs on the server it’s running on. The box hosting that MySQL server is an old HP. It’s got 1 Pentium II 400mhz processor with 128Mb of RAM. And it serves data to anywhere between 10 and 14 seperate PC’s at any given point in time. In addition to that, this MySQL server also provides data to a web interface that is used by 50 or so people. The MySQL server pumps out about 500Mb worth of data every day.

MySQL never ceases to amaze me in what it can do on less than optimal hardware.