19

I am looking for hosting for my website, which is built in PHP. In the past I have used GoDaddy (first few websites), but would like to use a more advanced hosting company.

Does Heroku support a PHP website? There are a lot of answers about a Facebook application, but none about a PHP + MySQL website.

Don P
  • 60,113
  • 114
  • 300
  • 432
  • 6
    Why dont you call / email Heroku? – Green Black Nov 11 '12 at 18:23
  • Seems they do: http://hakre.wordpress.com/2012/05/20/php-on-heroku-again/ – Green Black Nov 11 '12 at 18:27
  • 1
    @John they don't provide a contact phone number. – Don P Nov 11 '12 at 18:31
  • 2
    While that link is accurate in that it shows Heroku does support PHP, do not follow its instructions! Opening a bash shell on a Heroku dyno to install a plugin is totally incompatible with how Heroku runs apps on multiple anonymous nodes. Please see my answer below on how to use a custom buildpack that includes zlib etc. – Andrew Gorcester Nov 11 '12 at 18:41
  • 3
    What is it with you people? Stop closing questions like this as "not constructive"! The question is "Does Heroku support a PHP website?" and it very clearly has an answer based on facts. Luckily a good answer was posted before it was closed for no good reason. – thomasruns Jan 17 '14 at 22:59

2 Answers2

42

Heroku supports PHP de facto. They originally supported PHP for Facebook apps specifically but now host many production PHP sites that are not Facebook apps. (Source -- direct communication with Heroku sales earlier this year.)

There is an official PHP buildpack (see the docs for info on what buildpacks are and how they work).

There are also many unofficial PHP buildpacks that improve on the original. The official PHP buildpack has a single blocking Apache worker and little support for add-ons. It also doesn't use Vulcan to build binaries. See my buildpack, intended for Wordpress or other memory-intensive applications, or my buildpack's parent, the Winglian buildpack.

UPDATE: Heroku now officially supports PHP and provides a drastically improved official buildpack.

Andrew Gorcester
  • 19,595
  • 7
  • 57
  • 73
  • 1
    Yeah no idea who did that, your answer is great thank you :) – Don P Nov 12 '12 at 03:30
  • 3
    +11: +1 for answer, +10 for custom buildpack ;-) – DrFriedParts Dec 30 '12 at 00:21
  • @Andrew: How do I proceed on installing Wordpress after I run your buildpack? – dannyroa Jun 30 '13 at 18:49
  • 1
    @dannyroa Download and unpack wordpress in your project's git directory and add the wordpress files (plus your theme, etc) to the git repo. Then push to Heroku. (The same process applies to any other buildpack -- "Wordpress" is considered part of the application stack, whereas the buildpack provides apache and PHP to serve Wordpress.) – Andrew Gorcester Jun 30 '13 at 19:17
  • @AwalGarg Yes, but MySQL and MongoDB will need to be add-ons, not part of your deployed applciation. And PHP and node.js would be better off separated into two apps, but if you really want to run them on the same dyno, you can do so with a custom buildpack. – Andrew Gorcester May 05 '14 at 05:04
2

You can just launch a dyno on the Cedar stack and push PHP files directly.

rbaker86
  • 1,832
  • 15
  • 22