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:







2012年3月1日木曜日

cakephp 1.3 検索結果をpagenate




$params["GET_name"] = $this->params['url']['GET_name'];
$params["GET_kana"] = $this->params['url']['GET_kana'];
$params["GET_tel"] = $this->params['url']['GET_tel'];
$params["GET_address"] = $this->params['url']['GET_address'];



肝はコレだけ↓


$this->paginate['options']['?'] = $params;

2012年2月22日水曜日

CentOS メールキューの一括削除

mailq  キューの確認

postsuper -d ALL 一括削除


VPSなんかの場合メールを大量送信すると止められるからね。
そんな時に役立つメモ。



2011年7月15日金曜日

2.11系 ECCUBE 注文完了画面で決済方法の取得など

http://xoops.ec-cube.net/modules/newbb/viewtopic.php?topic_id=8266&forum=10



LC_Page_Shopping_Complete.php の action()に下記2行を追加

$objPurchase = new SC_Helper_Purchase();
$arrOrder = $objPurchase->getOrder($_SESSION['order_id']);

$arrOrderの中身はこれ

Array (54)
order_id => "11"
order_temp_id => "abcdefgxxxxxxxxxxxx"
customer_id => "1"
message => null
order_name01 => "山本"
order_name02 => "太郎"
order_kana01 => "ヤマモト"
order_kana02 => "タロウ"
order_email => "test@example.com"
order_tel01 => "03"
order_tel02 => "1111"
order_tel03 => "2222"
order_fax01 => null
order_fax02 => null
order_fax03 => null
order_zip01 => "100"
order_zip02 => "0001"
order_pref => "13"
order_addr01 => "てすと住所1"
order_addr02 => "てすと住所2"
order_sex => "1"
order_birth => null
order_job => null
subtotal => "5040"
discount => null
deliv_id => "1"
deliv_fee => "0"
charge => "0"
use_point => "0"
add_point => "50"
birth_point => "0"
tax => "0"
total => "5040"
payment_total => "5040"
payment_id => "5"
payment_method => "クレジットカード決済"
note => null status => "1"
create_date => "2011-01-15 16:01:22"
update_date => "2011-01-15 16:01:22"
commit_date => null payment_date => null
device_type_id => "10"
del_flg => "0"
memo01 => null
memo02 => null
memo03 => null
memo04 => null
memo05 => null
memo06 => null
memo07 => null
memo08 => null
memo09 => null
memo10 => null