1. Download and install Heroku Toolbelt:
https://toolbelt.heroku.com/
2. Install Heroku Push (because port 22 is blocked by University’s firewall)
heroku plugins:install https://github.com/ddollar/heroku-push
1. Create an empty project and Git Repository
mkdir heroku-php cd heroku-php git init
2. Commit to Git
Place the PHP files in the created directory
Now add to git:
git add -A
Now commit:
git commit -m "Initial commit"
3. Create your Heroku app
This is the important step. When creating a PHP app on heroku you have to make sure you choose the ‘Cedar’ Stack.
heroku create --stack cedar
The response should look something like:
Creating damp-wildwood-1022... done, stack is cedar http://damp-wildwood-1022.herokuapp.com/ | git@heroku.com:damp-wildwood-1022.git Git remote heroku added
Now push to the repository:
heroku push
The response should now look a little like:
Checking for app files to sync... done, 1 files needed Uploading: 100.0% Launching build process... done Preparing app for compilation... done Fetching buildpack... done Detecting buildpack... done, Buildkit+PHP Fetching cache... done Compiling app... Compiling for PHP Bundling Apache version 2.2.22 Bundling PHP version 5.3.10 Putting cache... done Creating slug... done Uploading slug... done Success, slug is https://api.anvilworks.org/slugs/603d9820-290d-49c5-8064-49dfef4dc618.tgz Releasing to damp-wildwood-1022... ....done, v11
Test! You’re done
Notice Heroku gives you an auto generated app name. If you look in the first response in step 3, Heroku tells you the URL of your app. Mine is http://damp-wildwood-1022.herokuapp.com.
Now you would definitely want your app name to look tidy. Do this:
heroku apps:rename newname
Once you are done editing all the project files,
heroku open
should take you to your app on a web browser.