Heroku PHP Basic App

Here, I will be creating a simple PHP application to show you how to create a basic PHP app and upload it to heroku all through the commands in the terminal.

This assumes you already have a computer with the following requirements:

  1. node.js
  2. git
  3. Visual Code
  4. Heroku CLI

These are the commands:

1. Create a new directory with the application name

mkdir heroku-app-202110080825pm
cd heroku-app-202110080825pm

2. Open the newly created folder with Visual Code.

code .

3. Create the 3 required files:

echo "<h1>Hello World This is a Herokup heroku-app-202110080825pm</h1>" > home.html 
echo '<?php include_once("home.html"); ?>' > index.php
echo '{}' > composer.json

4. initialig GIT projecct

git init
git add .
git commit -m "initial"

5. login to heroku

heroku login

6. create app [yearMonthDayHourMinutes]

heroku create heroku-app-202110080825pm

OUTPUT:Creating ⬢ heroku-app-202110080825pm... donehttps://heroku-app-202110080825pm.herokuapp.com/ | https://git.heroku.com/heroku-app-202110080825pm.git4. publish app

heroku git:remote -a heroku-app-202110080825pm

OUTPUT: set git remote heroku to https://git.heroku.com/heroku-app-202110080825pm.git5. PUSH app to heroku

git push heroku master

6. OPEN APP
https://heroku-app-202110080825pm.herokuapp.com


END

The following are notes from version 1 of this page. Ignore and follow the instructions above instead.

Follow these steps to get started with publishing a simple static index.html file to a herokup application

CREATE A SIMPLE index.html file

TIP: The first thing to do if you have visual code, is to create a folder and open that empty folder with vscode and then open the terminal in vscode.

# ADD THE FOLLOWING MINIMAL FILES. YOU HAVE TO INCLUDE AN INDEX.PHP FILE TO MAKE HEROKU THINK THIS IS A PHP SERVER

NOTE: For this example, I will be naming my app app2-202110062003

echo "<h1> Herokup app2-202110062003</h1>" > home.html echo '<?php include_once("home.html"); ?>' > index.phpecho '{}' > composer.json1. initialing projecctgit initgit add .git commit -m "initial"2. login to herokuheroku login3. create app [yearMonthDayHourMinutes]heroku create app2-202110062003OUTPUT:Creating ⬢ app2-202110062003... donehttps://app2-202110062003.herokuapp.com/ | https://git.heroku.com/app2-202110062003.git4. publish appheroku git:remote -a app2-202110062003OUTPUT: set git remote heroku to https://git.heroku.com/app2-202110062003.git5. PUSH app to herokugit push heroku master6. OPEN APPhttps://app2-202110062003.herokuapp.com