Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploy PHP to Heroku

People also ask

Can I deploy PHP on Heroku?

Heroku PHP Support will be applied to applications only when the application has a file named composer. json in the root directory. Even if an application has no Composer dependencies, it must include an empty composer. json in order to be recognized as a PHP application.

Where can I deploy PHP apps for free?

000webhost. 000webhost is a free web host that support PHP and MySQL apps. It also comes with a control panel which has PhpMyAdmin and a web-based file manager. Although 000webhost enables deploying your web app via file upload and is free of charge, it also comes with great security risks.

Can I host PHP on GitHub?

Github pages currently do not support PHP as it only supports static website. However, if you want to display some dynamic content on your website, you can simply use iframe to display that content, but again it has to be hosted somewhere else.


You need to create your Heroku app on the new Cedar stack. Cedar stack apps reside on the domain herokuapp.com rather than heroku.com, so you'll know if you've got the right one. Then it's really as simple as pushing your PHP files. To create an app on the Cedar stack, use:

heroku create

Or, if you'd like to set a name, (i.e. myname.herokuapp.com) use:

heroku create myapp

For the benefit of others who are not as au fait with Git, you will also need to set up, commit and push your Git repository:

git init
git add .
git commit -m 'Initial commit'
git push heroku master

That's it! Good luck and have fun.


You don't need to do anything - just push your PHP code up and Heroku magic will occur - I'm no PHP guru but recently had to deploy a PHP site and I just pushed the code as is to a new Cedar app, no changing of directory structures etc and it works.