Virtual Host configuration in Ubuntu 14.04

sudo apt-get update sudo apt-get install apache2

Step 1 – Create the directory structure

sudo mkdir -p /var/www/

Step 2 – Grant Permissions

sudo chown -R $USER:$USER /var/www/
sudo chmod -R 755 /var/www

Step 3 – Create new virtual host files.

cd /etc/apache2/sites-available
sudo cp 000-default.conf
sudo nano /etc/apache2/sites-available/
<VirtualHost *:80>
    DocumentRoot /var/www/
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined


Step 4 – Enable the new virtual host file

sudo a2ensite
sudo service apache2 restart

Step 5 – Set up local hosts file

sudo nano /etc/hosts

Step 6 – Test your results

Slim a micro framework for PHP


  • Instal composer
php -r "copy('', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '92102166af5abdb03f49ce52a40591073a7b859a86e8ff13338cf7db58a19f7844fbc0bb79b2773bf30791e935dbd938') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"


Install Slim

  • Create you project folder and create these folders inside.
├── project
│   └── src
│       └── public
  • Go into the /src folder in your project directory and execute this command.
composer require slim/slim "^3.0"
  • Install composer.phar
curl -sS | php
  • To install dependencies, execute he composer.phar
php composer.phar require slim/slim
  • git ignore the vendor folder
    • Create .gitignore folder inside src/ and add this single line.
  • Create the application
    • create src/public.index.php file and add this code.
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;

require '../vendor/autoload.php';

$app = new \Slim\App;
$app->get('/hello/{name}', function (Request $request, Response $response) {
    $name = $request->getAttribute('name');
    $response->getBody()->write("Hello, $name");

    return $response;


  • Run this command from src/public
php -S localhost:8080
  • Then go to http://localhost:8080/
    • This will show you an error. DO NOT WORRY. Use http://localhost:8080/hello/sugith

Run your application with Apache

  • Set the virtual host configuration.
  • Set the public folder as the Document Root
  • Add .htaccess file into src/public directory.
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L]


 Install dependencies

composer require slim/twig-view
composer require monolog/monolog


Setup a drupal website with Drush – Ubuntu

sudo apt-get install drush

cd /var/www/html/

mkdir drupal

drush dl

cd drupal-7.36

mv * ..
mv .gitignore ..
mv .htaccess ..

cd ..

rmdir drupal-7.36

help -> drush help site-install

drush site-install --db-url=mysql://root:root@localhost:<port>/<db_name> --account-name=admin --account-pass=drupal --account-mail="" --site-name="Test Site" --site-mail=""

drush dl token, pathauto, ctools, views, panels, adaptivetheme, corolla, addthis, devel, og, rules

drush en token, pathauto, ctools, views, panels, adaptivetheme, corolla, addthis, devel, og, rules

ctools-> page manager
view content panes

devel -> devel generate
Rule UI
Views UI


Theme should have

  • <name> (sql snapshot)
  • <site name>.zip

  • download
  • install
  • download drupal core 7.x
  • extract drupal core 7.x
  • copy the folder next to acquia-drupal folder
  • rename the drupal core folder to the site’s name
  • go back to acquia dev desktop control panel.
    • settings > sites > import
    • site path -> folder location of the site
    • set DB -> new DB name
    • change host to the website name -> subset of eclipse