composerを使ってcakeをinstallして新しいプロジェクトを作成
今日はプログラム詳しい人とお会いしていろいろ教えてもらったあ
composerを使ってcakeをインストールしようとしたところmcryptがないと怒られる。
# yum --enablerepo=remi-php56 install php-mcrypt php-xml
- composerでcakeをインストール
# php composer.phar install
- ちなみにcomposer.jsonの中身はこんな感じ
{ "name": "example-app", "require": { "cakephp/cakephp": "2.7.*" }, "config": { "vendor-dir": "Vendor/" } }
- 新規プロジェクトを作成
# mkdir test # Vendor/bin/cake bake project test
以上で新規プロジェクトをcompserで作成できましたあ
- apacheのログ
ドキュメントルートとかのファイルは
/etc/httpd/conf.d配下に
xxxxx.confファイルを作成して
中身はこんな感じ
VirtualHost *:80> ServerName ドメイン名 DocumentRoot /var/www/html/プロジェクト名/webroot AddDefaultCharset UTF-8 RewriteEngine on RewriteCond %{HTTP_HOST} ^(www\.ドメイン名)(:80)? [NC] RewriteRule ^/(.*) http://ドメイン名/$1 [R=301,L] <Directory "/var/www/html/プロジェクト名/webroot"> AllowOverride all DirectoryIndex index.html index.php </Directory> </VirtualHost>
これからcakeのチュートリアルどんどん進めてサービス作って行きますー
***追記: 2016 1/29 ***
document rootを変更した後に僕の設定だと以下のファイルを変更する必要あり
プロジェクト名/webroot/index.php
define('CAKE_CORE_INCLUDE_PATH', DS . 'var' . DS . 'www' . DS . 'html' . DS . 'Vendor' . DS . 'cakephp' . DS . 'cakephp' . DS . 'lib');