Appendix A. Toolchain

Table of Contents
Installing Toolchain for Web Development
First We Check and Clean
Package Managers for Your Operating System
Install XAMPP
Install IDE: PhpStorm
Install PHPUnit
Composer, the PHP Dependency Manager
Install XDebug
Install Dia
Install Node.js
Install Git, Version Control System
Install Secure Shell
A Test Database

Installing Toolchain for Web Development

First We Check and Clean

In order to work on an even footing we must make sure that all are working with the proper version of the software we need. This requires you to erase old versions you may have installed from previous programs.

Do you have any of the following installed:

  • MAMPP
  • WAMPP
  • XAMPP with PHP < V7.2.*

It must be uninstalled. Period!

Important: If you have documents in an htdocs, or www folder belonging to any of MAMPP, WAMPP, or XAMPP you may want to save it to another place on your hard drive before you erase MAMPP, WAMPP, or XAMPP. You can move it back after installation of the new software versions.

When the above is done, you must proceed with the following.

Package Managers for Your Operating System

A package manager can help you with all aspects of installing and maintaining software on your computer. Now, is your OS

Linux
You have a package manager.
Mac OSX

Download and install HomeBrew. This is easily done from a terminal. Start a terminal and run

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Source: https://brew.sh/

MS Windows

Download and install Chocolatey. This is easily done from the CLI, Command Line Interface. Start cmd as administrator and run

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

A bit of a mouthful for sure, but Ctrl-C, Ctrl-V does wonders.

Source: https://chocolatey.org/install.

Install XAMPP

An AMP Stack is a set of software that got it's name as an acronym made of the initial letters of it's constituent elements.

A
Apache, the web server.
M
Originally MySQL, nowadays MariaDb which is a better MySQL than MySQL. The database system chosen for this course.
P
PHP, PHP Home Pages. Our backend programming language of choice.

The X was originally for Unix, nowadays it could be interpreted as cross platform. The extra P was originally for Perl, another backend programming language. Now extremely rarely used for the web.

Now you must do one of the following

Windows

Now we will benefit from installing Chocolatey. Start cmd as administrator and do

choco install bitnami-xampp -y

Once you have it, maintenance is simple. Start the CLI and do

choco upgrade bitnami-xampp -y
OSX
Now do
brew cask install xampp

OSX may have a php and a mysql for internal use. Therefore you must, in your home directory, with your favorite editor create a file .bash_profile. Write the following two lines in that file

PATH=/Applications/XAMPP/xamppfiles/bin:$PATH
export PATH

Then exit any open terminal.

Start the manager-osx from the XAMPP directory in Applications.

Verify the presence of php from a terminal by

php -v

expect something similar to

PHP 7.2.9 (cli) (built: Aug 17 2018 16:21:18) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

Verify the presence of MariaDB from a terminal by

mysql --version

and expect something similar to

mysql  Ver 15.1 Distrib 10.1.35-MariaDB, for ...

Install IDE: PhpStorm

An integrated Development Environment, IDE for short, normally contains all the necessary functionality for handling development projects. Based on student experience from the past we shall try PhpStorm.

In Windows
From an administrator terminal do
choco install phpstorm -y
In OSX
brew cask install phpstorm

PhpStorm is not free software. You get a 30 day evaluation license when you download and install. During that month you may apply for a free student license at https://www.jetbrains.com/phpstorm/download/. They will ask you to document your studentship. This may be done with a picture of an enrollment letter from a relevant program. Bachelor of Web Development is.

Install PHPUnit

Windows
PHPUnit is part of the XAMPP package, and it is integrated in PhpStorm. This means that you're good whether you use the IDE or you choose to work with your own editor.
OSX
brew

Verify the presence of phpunit from a terminal by

phpunit --version

and expect something similar to

PHPUnit 7.0.2 by Sebastian Bergmann and contributors.

Composer, the PHP Dependency Manager

Windows
From an administrator terminal do
choco install composer -y

when it finishes

refreshenv
In OSX
brew install composer

Verify the presence of composer from a terminal by

composer - V

and expect something similar to

Composer version 1.7.2 2018-08-16 16:57:12

Install XDebug

To install Xdebug go to https://xdebug.org/download.php.

procedure pending

Install Dia

Dia is a free multi platform diagramming editor, ie a tool for making diagrams. It has many different types of diagrams, including ER, all the various UML diagrams and many more.

In Windows
From an administrator terminal do
choco install dia -y
In OSX
brew cask install xquartz
brew cask install dia

There is an omission in the procedure. You must find the file

/Applications/Dia.app/Contents/Resources/bin/dia open it in your favorite editor and insert the following three lines just before line 40:

# Ref: http://navkirats.blogspot.de/2014/10/dia-diagram-mac-osx-yosemite-fix-i-use.html
versionOSX=$(sw_vers -productVersion | awk -F '.' '{print $(NF-1)}')
[[ ${versionOSX} -ge 10 ]] && export DISPLAY=:0

Save the file, and you're done. Dia may be started from the Applications directory.

Verify the presence of dia by starting it from the applications menu.

Install Node.js

There are several good ways to install Node.js on your computer. You may wish to refer to https://nodejs.org/en/download/package-manager. I recommend maintaning the software by nvm, the Node Version Manager. This entails installing that first.

Linux
Use your package manager, eg (depending on your distribution)
yay -S nvm
Mac OS/X
Start a terminal end enter
brew install nvm
MS Windows
Start a terminal as administrator and enter
choco install nvm

Follow this in any operating system by the following command issued in a non administrator terminal. This command incidentally also gets the latest version, if used at a later date.

nvm install node

This command will install Node.js and npm the Node Package Manager. If you one day may decide to develop node software as another user, just repeat this last command from that users home directory.

Install Git, Version Control System

Windows
From an administrator terminal do
choko install git -y
OSX
brew install git

Irrespective of platform start a terminal and key in the following, each line concluded with a carriage return (enter, ↵), and substituting your own details for foo.

git config --global user.name "foo"
git config --global user.email "foo@foo.bar"
git config --list

Now git is ready for regular use.

Install Secure Shell

Windows
SSH comes with the Git installation, so it should already be installed. There's no path to it from the regular terminal, so start the Git Bash terminal to activate it.
OSX
In OSX rumour has it that SSH is part of a standard OSX installation.

Verify the presence of SSH from a terminal by

ssh -V

and expect something similar to

OpenSSH_7.8p1, OpenSSL 1.1.0i  14 Aug 2018

A Test Database

This material has a database chosen for examples of queries

  • To get the newworld database, download   worldFK.sql and place it in your home directory.

Start your terminal, key in mysql and press

mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 10.1.35-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> create database newworld;
Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> use newworld
Database changed
MariaDB [newworld]> \. worldFK.sql
...
...
\q

You are now the proud owner of the newworld database with content.