- Download and install Docker Desktop
- Have Docker running
- Have git installed and setup (see Your Identity for setup)
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.
- 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) - Once your repo is done downloading, navigate inside of it using
cd <name-of-repo>
- Run
docker compose up
- 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
.
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:
- Create database with
CREATE DATABASE cp476;
- Select your database with
USE cp476;
- 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!