Skip to content

Latest commit

 

History

History
46 lines (34 loc) · 2.57 KB

README.md

File metadata and controls

46 lines (34 loc) · 2.57 KB


CP476 - Internet Computing Boilerplate

Simple one-line solution to installing and setting up PHP, Apache, and MySQL on any operating system.

GitHub forks

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. Fork this repository
  2. 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 gree "Code" button)
  3. Once your repo is done downloading, navigate inside of it using cd <name-of-repo>
  4. Run docker compose up
  5. 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 test, why don't we make that database as practice.

  1. Create database with CREATE DATABASE test;
  2. Select your database with USE test;
  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!