Skip to content

ian-maurmann/demo-2023-08-29a

Repository files navigation

demo-2023-08-29a

Demo


Overview

The word density helper opens with a list of given URLs: Screenshot 1

New URLs can be added with the "Add New URL" button: Screenshot 2

Clicking on the URL opens the list of word-density tests run to-date: Screenshot 3

When clicking on the test, the word-density results are listed: Screenshot 4

Local Installation

1) Clone / Copy to project folder.

2) Install Composer

  • Open the terminal and navigate to the project folder.
  • Install Composer. Follow the instruction at Download Composer.

3) Run Composer

  • Test PHP version is 8.2 or higher
php -v
  • See that Composer is really there and working.
php composer.phar
  • Run Composer:
php composer.phar install

php composer.phar update
  • Check that everything was installed correctly. Review the list of installed packages with Composer Show:
php composer.phar show

composer.phar show

Also for further reference, here's the composer-cheat-sheet by u/nicwortel https://cheat-sheets.nicwortel.nl/composer-cheat-sheet.pdf

3) Copy the migration script to run the Doctrine migrations

cp vendor/pith/framework/mig .

4) Configure the Env file

  • Copy env.dist.php to env.php
  • Add your own settings.

5) Run Migrations

  • Test that doctrine migrations will work.
php mig
  • Look at the list of migrations
php mig migrations:list
  • Run all migrations
php mig migrations:migrate
  • The list of migrations should all be green now
php mig migrations:list

mig migrations:list

  • The database tables should all exist now.

Sequel Pro table list

Run Local

Navigate to the public-local folder i.e:

cd public-local/

Tell PHP to run locally on port 8080, using serve.php

Ex:

php -S 127.0.0.1:8080 serve.php

Now open your web browser and open http://127.0.0.1:8080/

The project should be live and running now.

LAMP non-local install

1) SSH into webserver

https://www.wikihow.com/Use-SSH

2) Check PHP version on running on the server

  • Test PHP version is 8.2 or higher
php -v

3) Create repositories/ folder

Create a repositories/ folder outside the webroot.

i.e. Go to lowest folder:

cd ~

Look at folder. Look to see if the repositories/ folder already exists.

ls 

ls -la

Create repositories/ folder

mkdir repositories

ls

4) Clone to repositories folder.

Check that Git is already installed.

git --version

Clone

git clone https://github.com/ian-maurmann/demo-2023-08-29a.git

There should now be a demo-2023-08-29a/ folder inside of repositories/

Screenshot 1

ls

5) Install Composer

  • Open the terminal and navigate to the project folder.
  • Install Composer. Follow the instruction at Download Composer.

6) Run Composer

  • Test that Composer is really there and working.
php composer.phar
  • Run Composer:
php composer.phar install

php composer.phar update
  • Check that everything was installed correctly. Review the list of installed packages with Composer Show:
php composer.phar show

7) Copy the migration script to run the Doctrine migrations

cp vendor/pith/framework/mig .

8) Create MySQL / MariaDB database

Create a MySQL or MariaDB database on the server, or at a location that the server can remotely connect to.

Keep the new database info, and data user info on-hand for the next step.

9) Configure the Env file

  • Copy env.dist.php to env.php
cp env.dist.php env.php
  • Add your own settings to env.php. To edit this you'll want to use Vim or else have FTP access. On Mac I use Cyberduck. Ex:

It should look something like:

/**
* Env Constants
*
* @noinspection PhpConstantNamingConventionInspection - Long constant names are ok here.
*/

// Turn on strict types
declare(strict_types=1);

// Define our Constants
const PITH_APP_DATABASE_DSN           = 'mysql:host=127.0.0.1;dbname=XXXXXXXXXXXXXX';
const PITH_APP_DATABASE_USER_USERNAME = 'YYYYYYYYYYYYYYYYY';
const PITH_APP_DATABASE_USER_PASSWORD = 'ZZZZZZZZZZZZZZZZZ';

const PITH_DATABASE_MIGRATIONS_DATABASE_NAME   = 'XXXXXXXXXXXXXX';
const PITH_DATABASE_MIGRATIONS_DATABASE_HOST   = '127.0.0.1';
const PITH_DATABASE_MIGRATIONS_DATABASE_DRIVER = 'pdo_mysql';

const PITH_DEV_ACCESS_IP_ADDRESSES = ['127.0.0.1'];

const PITH_IMPRESSION_LOG_ENABLE   = false;
const PITH_IMPRESSION_LOG_LOCATION = 'logs/impressions-log';

Where XXXXXXXXXXXXXX is the database's name or schema name, YYYYYYYYYYYYYYYYY is the database user name, and ZZZZZZZZZZZZZZZZZ is database user password.

10) Run Migrations on the server to set up our tables on the database

  • Test that doctrine migrations will work.
php mig
  • Look at the list of migrations
php mig migrations:list
  • (If your env.php isn't configured correctly above, you'll get an error like:

Screenshot 1

)

If your env.php is correct though, you should now see the list in yellow

Screenshot 1

  • Run all migrations
php mig migrations:migrate
  • The list of migrations should all be green now
php mig migrations:list
  • The database tables should all exist now.

11) Update the .htaccess file

On the server, go into the web root folder and update (or create) the .htaccess file.

It should be something like:

# Hide folders
Options -Indexes

# Turn on the Rewrite Engine
RewriteEngine On


# Force HTTPS
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Rewrite non-existent files to index
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php [NC,L]

Where routes and non-existent files are being rewritten to the index.

11) Update the Index file in the web root folder

Add / update the index.php file in the web root folder to this:

<?php 

error_reporting(E_ALL);
ini_set('display_startup_errors', '1');
ini_set('display_errors', 1);

// Switch folders
chdir('../../repositories/demo-2023-08-29a/'); // <---- Change to correct folder

require 'public-web/index.php';

(If there's an index.html file, rename or delete it so that it doesn't take precedence over index.php)

The project should be live and running on the web server now.

Releases

No releases published

Packages

No packages published

Languages