togatttiのエンジニアメモ

過度な期待はしないでください.

ZendFramework2系をインストールしてみた。

ZendFramework2系をインストールしてみた。

準備

  • httpd.confの設定などで.htaccessは使えるようにしておく。

AllowOverRide Allの設定。

  • phpは5.1.4以上を用意。
  • Gitも用意。

Git clone

インストール自体はGitからcloneするだけだったから簡単。

しかし、下記のようなエラーが出てしまった。

Warning: Unexpected character in input: '\' (ASCII=92) state=1
Parse error: syntax error, unexpected T_STRING in

調べてみると、以下の記事を発見。

Apparently, the server was running PHP 5.3 in the SSH console, however the Apache server was still using PHP 5.2, therefor unable to use namespaces.

So, even though the account was setup for "PHP 5.3", the .htaccess needs to be changed in order to support that.

In order to fix the problem, add the following line to the .htaccess file in the /public/: AddHandler x-httpd-php5-3 .php

php - Setting up Zend Framework 2 on GoDaddy - Stack Overflow

どうやらPHPのバージョンを.htaccessで指定する必要があるみたい。
= /public/.htaccessへ使用するphpのバージョンをAddHandlerで指定すればOK。

当方、php5.5を入れたばかりだったので、

AddHandler x-httpd-php5-5 .php

を追記。

どうやら無事に表示されたみたいだ。

f:id:togattti1990:20130820070953j:plain

これから細かい設定を見ていこう。

参考:Simpla Note: Zend Framework 2 : Instalation and Make a Module