お試しContao 4.0-beta1
Contao 4.0.0-beta1を少し試してみましたが、すんなりインストールするのも難しい状況でした。
Apacheの設定
従来はContaoのファイルを展開したディレクトリをドキュメントルートとしていましたが、Contao 4.0.0-beta1のリリースにも書かれていたように、下位ディレクトリのweb
をドキュメントルートに設定します。
<VirtualHost *:80>
ServerAdmin webmaster@example.jp
DocumentRoot /usr/local/share/contao40/web
ServerName contao40.example.jp
CustomLog /var/log/httpd/contao40.log combined
</VirtualHost>
その一方、シンボリックリンクで参照しているとはいえ、Contaoのファイルを展開したディレクトリにはWebサーバーからアクセス可能にしておく必要があります。そうしないと、シンボリックリンクで参照しているドキュメントルート外となったファイルをアクセスできなくなります。
<Directory "/usr/local/share/contao40">
DirectoryIndex index.php index.html
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
Composerによるファイルの取得
現在のところ、Contao 4.0.0-beta1のインストールはComposerを使用して行うしかありません。Composerのインストールについては書きませんが、既にコマンドとしてインストールされている場合は次のようにしてContao 4.0.0-beta1に必要なファイルの取得と展開をできます。
# mkdir /usr/local/share/contao40
# cd /usr/local/share/contao40
# composer --no-ansi create-project contao/standard-edition . 4.0.0-beta1
Installing contao/standard-edition (4.0.0-beta1)
- Installing contao/standard-edition (4.0.0-beta1)
Downloading: 100%
...(以下省略)...
そして、最後にデータベース接続と電子メールの送信の設定について対話的に聞いてきますので、適切に入力します。(以前はインストールツールで設定していた項目の一部がこちらに写っています。)
doctrine/doctrine-bundle suggests installing doctrine/orm (The Doctrine ORM integration is optional in the bundle.)
Generating autoload files
Creating the "app/config/parameters.yml" file
Some parameters are missing. Please provide them.
database_host (localhost):
database_port (3306):
database_name (null): contao40
database_user (null): contao40
database_password (null): *****
mailer_transport (mail): smtp
mailer_host (127.0.0.1):
mailer_user (null):
mailer_password (null):
prepend_locale (false):
url_suffix (.html):
upload_path (files):
secret (ThisTokenIsNotSoSecretChangeIt):
すると、続いて残りのファイルの設定等の処理を行います。
Clearing the cache for the dev environment with debug true
Trying to install assets as symbolic links.
Installing assets for Symfony\Bundle\FrameworkBundle into web/bundles/framework
The assets were installed using symbolic links.
Installing assets for Contao\CalendarBundle into web/bundles/contaocalendar
The assets were installed using symbolic links.
Installing assets for Contao\CommentsBundle into web/bundles/contaocomments
...(中略)...
The assets were installed using symbolic links.
Created the /data/share/contao-4.0-beta1/files directory.
Created the /data/share/contao-4.0-beta1/system directory.
Created the /data/share/contao-4.0-beta1/templates directory.
Created the /data/share/contao-4.0-beta1/web/system directory.
Created the /data/share/contao-4.0-beta1/assets/css directory.
Added the /data/share/contao-4.0-beta1/assets/css/.gitignore file.
Created the /data/share/contao-4.0-beta1/assets/images directory.
...(中略)...
Created the /data/share/contao-4.0-beta1/web/system/cron directory.
Added the /data/share/contao-4.0-beta1/web/system/cron/.gitignore file.
Added system/themes/flexible as symlink to ../../vendor/contao/core-bundle/src/Resources/contao/themes/flexible.
Added web/assets as symlink to ../assets.
Added web/system/themes as symlink to ../../system/themes.
Added system/logs as symlink to ../app/logs.
インストールツールの起動
ファイルの展開等が終わると、次はインストールツールを使ってインストール作業を行います。今回の例では次のURLにアクセスします。
http://contao40.example.jp/app.php/contao/install
Contao 3までのcontao/install.php
と異なり、最後の.phpは必要ありません
。
使用許諾への合意
いつもの使用許諾への合意の画面の表示です。
インストールツールのパスワード設定
インストールツールにパスワードを設定します。
データベースの更新
データベースの更新の画面が表示されます。
なお、データベース接続は先に設定しているため、誤りがなければ折り畳まれている部分を開くと次のようになっているはずです。もし、パスワードの誤りなどがあった場合はContaoを展開したディレクトリ以下のapp/config/parameters.yml
を編集してください。
また、データベースの照合順序の設定についても確認しておきます。
管理者ユーザーの作成
データベースの更新を完了すると管理者ユーザーを作成します。Contao 4.0.0-beta1でのセッション周りの既知の問題と考えられますが、1度目の入力は無視され、2留で登録できました。
管理者ユーザーの作成が完了するとインストールツールの作業は終了です。
管理者ユーザーの作成の折り畳まれている部分を開くと、このようになっています。
バックエンドの動作
ここまで終わるとバックエンドにログイン画面を表示できるはずなので、インストールツールに表示されているリンクをクリックします。ところが、
これはContao 4.0.0-beta1の既知の不具合で、Github上では既に修正されています。これはデータベースのドライバーの情報がsystem/config/localconfig.php
に書かれていないために発生していますが、この情報は別のファイルで設定しているため記述が不要なものです。
また、保守モードを解除できないという問題もありますので、それを修正するために併せてsystem/config/localconfig.php
に以下を記述して回避できます。(参考: GIthubでの修正)
$GLOBALS['TL_CONFIG']['dbDriver'] = 'MySQLi';
$GLOBALS['TL_CONFIG']['maintenanceMode'] = false;
これでバックエンドのログイン画面は表示されました。
ところが、同じ画面の下部に次のようなエラーが表示されていました。
Fatal error: Uncaught exception 'RuntimeException' with message 'Failed to start the session because
headers have already been sent by "/usr/local/share/contao-4.0-beta1/app/bootstrap.php.cache" at line
1421.' in /usr/local/share/contao-4.0-beta1/app/cache/prod/classes.php:118 Stack trace:
#0 /usr/local/share/contao-4.0-beta1/app/cache/prod/classes.php(184): Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start()
#1 /usr/local/share/contao-4.0-beta1/app/cache/prod/classes.php(557): Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->getBag('contao_backend')
#2 /usr/local/share/contao-4.0-beta1/vendor/contao/core-bundle/src/Resources/contao/library/Contao/Session.php(138): Symfony\Component\HttpFoundation\Session\Session->getBag('contao_backend')
#3 /usr/local/share/contao-4.0-beta1/vendor/contao/core-bundle/src/Resources/contao/classes/BackendUser.php(120): Contao\Session->getData()
#4 [internal function]: Contao\BackendUser->storeSession()
#5 {main} thrown in /usr/local/share/contao-4.0-beta1/app/cache/prod/classes.php on line 118
これもセッション周りの問題のようで、ブラウザーが覚えているセッションを消去すると出なくなりました。
ログインできたバックエンドの画面では言語が英語だけなのと、機能拡張リポジトリに関連したメニューがなくなっているのがわかります。
以上のように、まだbeta1としての状態でした。