PHP on Heroku
Thursday, May 1st, 2014I'm looking at standing up an XML-RPC service written in PHP on the web, and I've been doing a lot of looking around, and found that Heroku really is about the best place for us at this point in time. It's got all the scalability we need, it's got Postgres, it's got redis, it's got all the things to mix-and-match all the work I need to do, and it's all in one place. I couldn't think of a better place.
But they haven't been doing PHP... until now.
This post talks about it, and it's really exceptionally simple... Start with a new directory and a simple index.php file:
<?php echo "Hello World!"; ?>
and in the same directory simply create a blank composer.json file:
$ touch composer.json
Finally, create the git repo, commit the new files, create the heroku app, and deploy:
$ git init Initialized empty Git repository in ~/hello_heroku_php/.git/ $ git add . $ git commit -m "Initial import of Hello Heroku" [master (root-commit) 06ba0a7] Initial import of Hello Heroku 2 files changed, 5 insertions(+) create mode 100644 composer.json create mode 100644 index.php $ heroku create Creating safe-ridge-5356... done, stack is cedar http://safe-ridge-5356.herokuapp.com/ | git@heroku.com:safe-ridge-5356.git $ git push heroku master ... $ heroku open
This is amazingly simple! Just what I needed.