So I started out with the Getting Started for PHP on the Heroku site in my efforts to get into the cloud. The step-by-step guide on the Heroku site is fairly straight forward. I made the following notes (I am using Windows 10):
- You will need Composer — I used the Composer-Setup.exe — you will need to restart PowerShell
- and PostgreSQL: http://www.enterprisedb.com/products-services-training/pgdownload#windows
- Open Windows PowerShell:
- I got this error trying to push changes to heroku:
ERROR: File '/composer.phar' isn't executable; please 'chmod +x'!
- I tried the following PowerShell commands:
- attrib +x composer.pha
- attrib +S composer.phar
- attrib -a composer.phar
- I also tried right-click Properties Security changing the permission on the file
- I finally found this solution — or rather workaround — on StackOverflow:
git add . git commit -m 'composer.phar removed' git push heroku master
However, as soon as I started trying to do more stuff with my Hello World app, I came unstuck, as it uses a whole heap of doohickies that I don’t work with, for instance, it uses the Symfony framework.
I personally prefer to start from a blank canvas as such without the additional bumf, using vanilla PHP. Here is my very simple “Hello World”:
- I had renamed my app:
heroku apps:rename foxbeefly
- I deleted my app: heroku apps:destroy foxbeefly
- To confirm deletion: heroku apps
- I created a new app on Heroku: foxbeefly
- I created new dir in my htdocs: foxbeefly
- I initialised the git repo: git init
- created the repo: heroku git:remote -a foxbeefly
- I created a simple
index.php
- I added my file to the repo: git add .
- I committed: git commit -m "Initial commit of new app"
- push changes: git push heroku master
- Opened my new app: heroku open and your app should open in your default browser
- If you go to your dashboard you will now see some resources
- Use heroku logs --tail to look for any errors
My “Hello World!” Heroku app is here: https://foxbeefly.herokuapp.com/