/cp467

Primary LanguagePHP


CP476 - 2023 Winter Group Project

Setup guide:

Prerequisites

  1. Download and install Docker Desktop
  2. Have Docker running
  3. Have git installed and setup (see Your Identity for setup)

How to Install

I highly suggest you keep your own repo so you have your own version control and a backup of your code. So if you don't have a github account, now is your time to make one.

  1. Navigate to where you want to store your code in terminal and clone your new repository with git clone <repoURL> (you can find this url by clicking the green "Code" button)
  2. Once your repo is done downloading, navigate inside of it using cd <name-of-repo>
  3. Run docker compose up
  4. Once docker finishes, your site will be live at localhost:8000

That's it! You're done.

Whenever you need to shutdown the container, do control + C in the terminal running it, and to reboot it use docker compose up.

How to Use

Now that docker is setup and running, you'll want to open a VSCode instance inside your repo. Navigate to index.php this is where you will be coding.

To use MySQL to create tables and data, you'll need to get inside the docker container to access MySQL. Open Docker Desktop and select the 3 dots beside db and "Open in terminal"

From inside you can run mysql -uroot -ppassword to access your instance of MySQL, in index.php mysqli is currently looking for a database called cp476. To create it if not already created:

  1. Create database with CREATE DATABASE cp476;
  2. Select your database with USE cp476;
  3. Create new table following this guide

Upon refreshing your browser you should see that the database connected successfully, now follow this guide to start using mysqli!