2012年10月12日金曜日

CakePHP Migrationsプラグイン関連まとめ

随時まとめると。

Migrations Plugin for CakePHP
https://github.com/CakeDC/Migrations

[CakePHP]データベース・スキーマの管理をCakePHP Migrations Pluginで行う
http://c-brains.jp/blog/wsg/11/09/16-085334.php

Migrationsプラグインの実践的運用
http://d.hatena.ne.jp/hiromi2424/20111220/1324387254

2012年10月5日金曜日

面倒なSSLの更新手順

手順

1.CSRの生成 CSRの提出→証明書受け取り
2.証明書をインストール

1. CSRの生成

擬似乱数の情報を生成
openssl md5 * > rand.dat
(読み込み可能なファイルがあるディレクトリにて実行)

秘密鍵を作成(パスフレーズの入力を求められる)
openssl genrsa -rand rand.dat -des3 2048 > secure.example.com.key
パスフレーズなしパターン
openssl genrsa -out secure.example.com.key 2048

CSRの生成
openssl req -new -key secure.example.com.key -out secure.example.com.csr

アルファベットにて入力
Country Name (2 letter code) [GB]:JP                                 
State or Province Name (full name) [Berkshire]:Tokyo 
Locality Name (eg, city) [Newbury]: Chuo-ku 市区町村
Organization Name (eg, company) [My Company Ltd]:Company Co.,Ltd.  正式英語組織名 会社名
Organizational Unit Name (eg, section) []:○◯事業部  部門名・部署名
Common Name (eg, your name or your server's hostname) []:secure.example.com  SSL利用のドメイン
Email Address []:  

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []: 
An optional company name []: 

CSRの生成完了。
VeriSignなどにSSL証明書発行の申請(各管理画面にCSRの貼り付けなど)

内容の確認
openssl req -in secure.example.com.csr -noout -text



補足
鍵がこのままだとhttpdを起動時にパスワードが聞かれるので
自動で立ち上がらなくなる。
以下パスワード無効にする方法(自己責任で)

鍵をコピー
cp -p secure.example.com.key secure.example.com.key.org
新しく鍵を生成
openssl rsa -in secure.example.com.key.org -out secure.example.com.key
Enter pass phrase for secure.example.com.key.org:
writing RSA key

※パスフレーズが設定されているかを確認する方法
openssl rsa -in secure.example.com.key
これでパスフレーズの入力を求められないなら設定されていない


2.証明書をインストール


証明書ファイル(メール等から貼り付けて保存)
secure.example.com.cert

中間CA証明書・クロスルート設定用証明書(貼り付けて保存)
secure.example.com.ca

ssl.conf等を修正
SSLCertificateFile  /path/to/secure.example.com.cert
SSLCertificateKeyFile  /path/to/secure.example.com.key
#SSLCertificateChainFile  /path/to/secure.example.com.ca
SSLCACertificateFile  /path/to/secure.example.com.ca

以上。

参考ベリサイン
https://www.verisign.co.jp/ssl/help/install/index.html#app

OSXでのPATH設定 cakephpのbake設定 MAMP使用時




 Getting command line access to PHP and MySQL running MAMP on OSX
 http://www.metaltoad.com/blog/getting-command-line-access-php-and-mysql-running-mamp-osx

あと下記ビデオがわかりやすかった。

ただターミナル立ち上げるたびに設定を有効にするために

. .profile

を打ち込まないとならない。

CakePHP Baking Console Setup (OS X, MAMP) from Sonny Scroggin on Vimeo.


pearコマンドのエラーが出る

参考
MAMP 2.0.5 の PEAR コマンドでエラーが発生する。

 /Applications/MAMP/bin/php/php5.3.6/conf/pear.conf
pear.conf ファイルを修正。

php_dir";s:43:

php_dir";s:44: