かまずにまるのみ。

文鳥とかビールとか

Symfony 2.3.0-RC1 インストールのメモ

Symfony の日本語ドキュメントを見ながらインストールしてみた。
Symfony のインストールと設定 | Symfony2日本語ドキュメント

環境

  • Mac OS X (Mountain Lion)
  • パッケージ管理には Homebrew を使用
  • PHP は 5.4.10 (php-build + phpenv で構築)

はまったところ

以下が原因でインストールに何度か失敗した。

  • PHP で Intl が有効になっていない
  • システムに ICU のライブラリが入っていない
  • app/cache, app/logs のパーミッション設定の不備
    • 設定時の確認不足…
    • ドキュメントどおりに設定すれば問題ない

やったことの記録

ダウンロードには Composer を使う方法を選択。
コマンドの最後にあるバージョン部分を "2.3.0-RC1" に変更して実行。

$ php composer.phar create-project symfony/framework-standard-edition ./Symfony 2.3.0-RC1
Installing symfony/framework-standard-edition (v2.3.0-RC1)
  - Installing symfony/framework-standard-edition (v2.3.0-RC1)
    Loading from cache

Created project in ./Symfony
Loading composer repositories with package information
Installing dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - symfony/icu v1.2.0-RC1 requires lib-icu >=4.4 -> the requested linked library icu has the wrong version installed or is missing from your system, make sure to have the extension providing it.
    - symfony/icu v1.1.0-RC1 requires lib-icu >=3.8 -> the requested linked library icu has the wrong version installed or is missing from your system, make sure to have the extension providing it.
    - symfony/symfony v2.3.0-RC1 requires symfony/icu >=1.0,<2.0 -> satisfiable by symfony/icu[v1.1.0-RC1, v1.2.0-RC1].
    - Installation request for symfony/symfony 2.3.* -> satisfiable by symfony/symfony[v2.3.0-RC1].

失敗した…

Intl がインストールされていること

http://docs.symfony.gr.jp/symfony2/reference/requirements.html?highlight=intl

The Intl Component

New in version 2.3.

The replacement layer is limited to the locale "en". If you want to use other locales, you should install the intl extension instead.

http://symfony.com/doc/master/components/intl.html

国際化関数 を有効にしていなかったのが原因っぽい。
configure のオプションに "--enable-intl " を追加して PHP を再ビルド。

$ php-build 5.4.10 ~/.phpenv/versions/5.4.10
…
[Preparing]: /var/tmp/php-build/source/5.4.10

 -----------------
 |  BUILD ERROR  |
 -----------------

 Here are the last 10 lines from the log:

 -----------------------------------------
 configure: error: Unable to detect ICU prefix or no failed. Please verify ICU install prefix and make sure icu-config works.
 -----------------------------------------

The full Log is available at '/tmp/php-build.5.4.10.20130517214312.log'.
[Warn]: Aborting build.

また足りないものが。
ICU のライブラリを brew でインストール。

$ brew search icu
icu4u
$ brew install icu4c
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/icu4c-51.1.mountain_lion.bottle.tar.gz
######################################################################## 100.0%
==> Pouring icu4c-51.1.mountain_lion.bottle.tar.gz
==> Caveats
This formula is keg-only: so it was not symlinked into /usr/local.

Conflicts; see: https://github.com/mxcl/homebrew/issues/issue/167

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/icu4c/lib
    CPPFLAGS: -I/usr/local/opt/icu4c/include

==> Summary
🍺  /usr/local/Cellar/icu4c/51.1: 235 files, 58M
$ brew link icu4c --force

PHP を再ビルドし、もう一度 Symfony のインストールを実行。

$ php composer.phar create-project symfony/framework-standard-edition ./Symfony 2.3.0-RC1
…
Writing lock file
Generating autoload files
Creating the "app/config/parameters.yml" file.
Some parameters are missing. Please provide them.
database_driver (pdo_mysql):

質問に答えてダウンロードが無事完了。
設定とセットアップ に従って設定を行い、ウェルカム画面表示まで確認できた。