Help us understand the problem. What is going on with this article?

Herokuで<?php phpinfo();

More than 5 years have passed since last update.

同内容の記事をTumblrで、コードはgithubで公開しています。

2014年4月29日にHerokuがPHPを公式にサポートを始めたので触ってみました。
phpinfo();を実行するためにした手順は以下の通りです。適当なディレクトリ内で行ってください。

まず、エディタ等でindex.phpと、依存関係を宣言するためのcomposer.jsonを作成します。

index.php
<?php
    phpinfo();
composer.json
{
    "require": {
        "php": "~5.5.0"
    }
}

Herokuにデプロイする際に、現状では"~5.5.0"という緩い設定だと警告が出ますが、無視できるそうです。

gitの初期化からherokuへのプッシュまでを以下のように行います。

$ git init
$ git add index.php composer.json
$ git commit -m 'initial commit'
$ heroku create
$ git push heroku master

これで$heroku open$ heroku createした際に表示されるurlにアクセスすることで動作が確認できます。

参考リンク

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away