Set up Pligg on The Cloud with AppFog

I came across an article on Flipboard yesterday mentioning the company AppFog, a web application provider that makes hosting in the cloud easy. Today I spent a short amount of time playing around with AppFog and their other service PHPFog to see just how easy it is to set up a Pligg website on their servers. It turned out to be easier than I expected.

What’s great about AppFog is that you can try them out for free, without having to add a credit card or anything to your account. Even cooler is that they give you up to 2GB worth of ram and 2GB worth of disk space. That should be enough to handle most Pligg sites, but should a time come that you need to expand your server resources you can do so very easily without interrupting service to your site.

Installing Pligg on AppFog

This tutorial covers the installation process for a Windows 7 user. These steps may not be correct for other windows versions, or for Mac and Linux users because of the different command prompt (terminal) utilities.

Step 1: Register an account at AppFog.com

Step 2: Create an App

  • Choose PHP.
  • Choose an infrastructure. I went with Amazon West.
  • Choose a name that will be used as your infrastructure service subdomain.

Step 3: Create a MySQL Database

  • From the “Mission Control” page, click on the services tab on the left.
  • Select MySQL
  • Enter a name for your MySQL database

Step 4: Edit your /libs/dbconnect.php file

Download the latest version of Pligg to your computer and unzip it into it’s own folder. Now navigate to Pligg’s /libs directory and open the dbconnect.php file to edit it. Place the following code in the file, replacing all existing content:

<?php
$services_json = json_decode(getenv("VCAP_SERVICES"),true);
$mysql_config = $services_json["mysql-5.1"][0]["credentials"];
$username = $mysql_config["username"];
$password = $mysql_config["password"];
$hostname = $mysql_config["hostname"];
$port = $mysql_config["port"];
$db = $mysql_config["name"];

define("EZSQL_DB_USER", $username);
define("EZSQL_DB_PASSWORD", $password);
define("EZSQL_DB_NAME", $db);
define("EZSQL_DB_HOST", "$hostname:$port");

define("EZSQL_DB_HOST", "$hostname:$port");
if (!function_exists('gettext')) {
	function _($s) {return $s;}
}
?>

Step 5: Install Ruby for Windows

Download and install Ruby for Windows on your computer. Once the installation process completes go to your computer’s Start button, Ruby directory, then launch “Start Command Prompt with Ruby”.

Step 6: Update Ruby

From the command prompt window opened in the last step, we are going to update Ruby to the latest version available. do so by running this command:

gem update --system

Step 7: Install AppFog for Ruby

gem install af

Step 8: Log into AppFog via Command Prompt

Log into AppFog using the account details that you use to log in to the AppFog website.

af login

Step 9: Change to your Pligg Directory

Next you will want to change what directory you are currently browsing from the command prompt tool to the directory where you have stored the Pligg files on your computer. You will need to customize the next line to point to that directory.

cd C:wamp/www

Step 10: Upload the files

Upload the current directory to the root of your AppFog. Replace “pligg” with your AppFog app name.

af update pligg

Step 11: Install Pligg

Since we have already configured the dbconnect.php file to connect your site to the database, we need to skip install steps 1-3. We will only need to run the last two steps, which will ask for your Pligg admin credentials and then install Pligg into your MySQL database. To do this, we will need to manually enter a URL.

Click on the “Visit Live Site” button that appears near the top of the AppFog website. Then manually add to the end of that URL:

/install/install.php?step=4

This will lead you to the final two installation steps, where you can complete the Pligg install.

You’re finished! Navigate to your AppFog URL to start managing your free Pligg site.

One last thing that I want to mention is that the PHPFog service provided by AppFog would probably make more sense for Pligg users, but the disadvantage to going that route is their limitations on the free accounts. AppFog allows for more server resources within the free account level. On the other hand, the big disadvantage to AppFog is that it is much less user friendly and gives you less control of your server through front-end interfaces.

4 thoughts on “Set up Pligg on The Cloud with AppFog

  1. Hi Eric,

    Glad you like our service! As one of the primary developers of both PHPFog and AppFog, I’d love to hear more about what you don’t find user friendly about AppFog. My goal is eventually to make AppFog easy enough to use that my mom could deploy a CMS or blog on it, so every bit helps.

    • PHPFog and AppFog differ in enough ways to justify the price difference. PHPFog provides tools like phpMyAdmin to manager your MySQL database, while AppFog targets a more technical audience that don’t rely on such tools to get the job done.

      What I would wish for is for slightly decreased prices for the PHPFog services. When you compare it to AppFog’s pricing it seems like you are paying a lot more for PHPFog’s improved UI and entry-level tools. There’s no 1:1 comparison of the pricing for two the services, since they don’t offer the same specifications, but it seems like you are getting a lot more bang for the buck out of AppFog. Appfog’s lowest paid plan at $100 offers 4GB of RAM, while PHPFog’s closest price tier is at $79/month with 1.7GB RAM. I’d love to use the platinum level of PHPFog to see how well it would work in comparison to my dedicated web host, but at the $249/month price it’s out of my reach.

  2. How do I remove the install directory after setup Pligg on Appfog? It doesn’t seem to provide FTP access.

    I tried remove the install folder, then issue commdn “af update …”, now I’m getting this error: Error. The pligg_config table is empty or does not exist

Comments are closed.