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/example.com/public_html

Step 2 – Grant Permissions

sudo chown -R $USER:$USER /var/www/example.com/public_html
sudo chmod -R 755 /var/www

Step 3 – Create new virtual host files.

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

 

Step 4 – Enable the new virtual host file

sudo a2ensite example.com.conf
sudo service apache2 restart

Step 5 – Set up local hosts file

sudo nano /etc/hosts
111.111.111.111 example.com

Step 6 – Test your results

http://example.com

Slim a micro framework for PHP

Installation

  • Instal composer
php -r "copy('https://getcomposer.org/installer', '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 https://getcomposer.org/installer | 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.
vendor/*
  • Create the application
    • create src/public.index.php file and add this code.
<?php
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;
});
$app->run();

 

  • 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="sugith@sugith.com" --site-name="Test Site" --site-mail="sugith@sugith.com"

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

ENABLE
blog
ctools-> page manager
view content panes

devel -> devel generate
Rule UI
Views UI




Themes

Theme should have

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

Acquia.com/downloads

  • 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

Aptana.com -> subset of eclipse