<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
		xmlns:xhtml="http://www.w3.org/1999/xhtml"
>

<channel>
	<title>zaru blog &#187; CakePHP</title>
	<atom:link href="http://zaru.tofu-kun.org/category/%e3%83%97%e3%83%ad%e3%82%b0%e3%83%a9%e3%83%9f%e3%83%b3%e3%82%b0_php/cakephp/feed/" rel="self" type="application/rss+xml" />
	<link>http://zaru.tofu-kun.org</link>
	<description>Web系のこととかー。</description>
	<lastBuildDate>Fri, 18 Nov 2011 02:28:49 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://zaru.tofu-kun.org/category/%e3%83%97%e3%83%ad%e3%82%b0%e3%83%a9%e3%83%9f%e3%83%b3%e3%82%b0_php/cakephp/feed/" />
		<item>
		<title>CakePHPで、MySQLとPostgreSQL両方を使いつつ、さらに違う文字コードに対応する方法</title>
		<link>http://zaru.tofu-kun.org/2011/04/28/cakephp%e3%81%a7%e3%80%81mysql%e3%81%a8postgresql%e4%b8%a1%e6%96%b9%e3%82%92%e4%bd%bf%e3%81%84%e3%81%a4%e3%81%a4%e3%80%81%e3%81%95%e3%82%89%e3%81%ab%e9%81%95%e3%81%86%e6%96%87%e5%ad%97%e3%82%b3/</link>
		<comments>http://zaru.tofu-kun.org/2011/04/28/cakephp%e3%81%a7%e3%80%81mysql%e3%81%a8postgresql%e4%b8%a1%e6%96%b9%e3%82%92%e4%bd%bf%e3%81%84%e3%81%a4%e3%81%a4%e3%80%81%e3%81%95%e3%82%89%e3%81%ab%e9%81%95%e3%81%86%e6%96%87%e5%ad%97%e3%82%b3/#comments</comments>
		<pubDate>Thu, 28 Apr 2011 06:42:58 +0000</pubDate>
		<dc:creator>zaru</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[プログラミング_PHP]]></category>

		<guid isPermaLink="false">http://zaru.tofu-kun.org/?p=343</guid>
		<description><![CDATA[めったにないタイプですが、つい先日すでに存在しているデータベースを使用して新しいサイトを立ち上げるという案件がありました。しかもMySQLはUTF-8だけど、PostgreSQLはEUC-JP…。おぉう。というわけで、CakePHPでサクっと両方のデータベースに対応してみました。 モデルの作成 config/database.php class DATABASE_CONFIG { //MySQL_DB var $default = array( 'driver' =&#62; 'mysql', 'persistent' =&#62; false, 'host' =&#62; 'localhost', 'login' =&#62; 'id', 'password' =&#62; 'pass', 'database' =&#62; 'name', 'prefix' =&#62; '', ); //PostgreSQL_DB var $pg = array( 'driver' =&#62; 'postgres', 'persistent' =&#62; false, 'host' =&#62; '192.168.0.100', 'login' =&#62; 'id', 'password' =&#62; 'pass', 'database' =&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>めったにないタイプですが、つい先日すでに存在しているデータベースを使用して新しいサイトを立ち上げるという案件がありました。しかもMySQLはUTF-8だけど、PostgreSQLはEUC-JP…。おぉう。というわけで、CakePHPでサクっと両方のデータベースに対応してみました。</p>
<h3>モデルの作成</h3>
<h4>config/database.php</h4>
<pre class="brush: php; title: ;">
class DATABASE_CONFIG {

 //MySQL_DB
 var $default = array(
  'driver' =&gt; 'mysql',
  'persistent' =&gt; false,
  'host' =&gt; 'localhost',
  'login' =&gt; 'id',
  'password' =&gt; 'pass',
  'database' =&gt; 'name',
  'prefix' =&gt; '',
 );

 //PostgreSQL_DB
 var $pg = array(
  'driver' =&gt; 'postgres',
  'persistent' =&gt; false,
  'host' =&gt; '192.168.0.100',
  'login' =&gt; 'id',
  'password' =&gt; 'pass',
  'database' =&gt; 'name',
  'encoding' =&gt; 'EUC_JP',
  'prefix' =&gt; '',
  'port' =&gt; 5432,
 );
}
</pre>
<h4>app_model.php</h4>
<pre class="brush: php; title: ;">
//PostgreSQL用（EUC）
class PgAppModel extends Model {

 function beforeFind($queryData) {
  // クエリパラメータの配列を、DB文字コードに変換
  array_walk_recursive($queryData, array($this, 'encodeToDbEncoding'));
  return $queryData;
 }

 function afterFind($results, $primary = false) {
  // 取得結果の配列を、内部文字コードに変換
  array_walk_recursive($results, array($this, 'decodeFromDbEncoding'));
  return $results;
 }

 function beforeSave($options = array()) {
  // saveするデータの配列を、DB文字コードに変換
  array_walk_recursive($this-&gt;data, array($this, 'encodeToDbEncoding'));
  return true;
 }

 function query() {
  // Model::queryは可変の引数をとるので同じようオーバーライドにする
  $params = func_get_args();
  array_walk_recursive($params, array($this, 'encodeToDbEncoding'));
  $results = call_user_func_array(array('Model', 'query'), $params);
  if (is_array($results)) {
   $results = $this-&gt;afterFind($results);
  }
  return $results;
 }

 function encodeToDbEncoding(&amp;$value, $key) {
  if (is_string($value)) {
   $value = mb_convert_encoding($value, 'EUC-JP', Configure::read('App.encoding'));
  }
 }

 function decodeFromDbEncoding(&amp;$value, $key) {
  if (is_string($value)) {
   //機種依存文字をEUC-JP -&gt; UTF-8にすると文字化けするので、一旦 sjis-win に変換する
   //$value = mb_convert_encoding(mb_convert_encoding($value, 'sjis-win','EUC-JP'),Configure::read('App.encoding'), 'sjis-win');
   //でも、一部の機種依存のみの対応で大丈夫そうなので、 eucJP-win にする
   $value = mb_convert_encoding($value,Configure::read('App.encoding'), 'eucJP-win');
  }
 }
}

//MySQL用（UTF-8）
class AppModel extends Model {
}
</pre>
<p>ちょっと気をつけたいのは、EUC-JPからUTF-8に変換する際に、機種依存文字（「①」「㈱」「Ⅰ」など）が文字化けしてしまいます。いったん、sjis-winに変換してからUTF-8に変換をすれば文字化けをすることがありません。よく使われる文字の対応だけであれば、eucJP-winからUTF-8への変換でいけるようです。</p>
<h4>各モデル</h4>
<pre class="brush: php; title: ;">
/**
 * PostgreSQLを利用するモデル
 */
class Hoge extends PgAppModel{

 var $name = 'Hoge';
 var $useDbConfig = 'pg'; //PostgreSQLのデータベース情報に対応
 var $useTable = 'hoge'; //CakePHPの命名規則に従ってない場合、ここで指定
 var $primaryKey = 'cid'; //プライマリーキーも同様

}

/**
 * MySQLを利用するモデル
 */
class Fuga extends AppModel{

 var $name = 'Fuga';

}
</pre>
<h3>トランザクション</h3>
<p>違うデータベースを使用していた場合でも、トランザクションはできます。</p>
<pre class="brush: php; title: ;">
//それぞれのモデルをロード
App::import('Model','MyModel');
App::import('Model','PgModel');
$my = new MyModel;
$pg = new PgModel;

//MySQLトランザクション
$dataSourceMy = $my-&gt;getDataSource();
$dataSourceMy-&gt;begin($my);

//PostgreSQLトランザクション
$dataSourcePg = $pg-&gt;getDataSource();
$dataSourcePg-&gt;begin($pg);

//結果格納用
$return = array();

//登録処理
$return[] = $my-&gt;save($data);
$return[] = $pg-&gt;save($data);

//ロールバック・コミット
if(in_array(false,$return,true)) {
	$dataSourceMy-&gt;rollback($my);
	$dataSourcePg-&gt;rollback($pg);

	return false;
} else {
	$dataSourceMy-&gt;commit($my);
	$dataSourcePg-&gt;commit($pg);

	return true;
}
</pre>
<p>もっとスマートな方法があるのかもしれないですが、とりあえずこれで複数データベースに対応ができます。</p>
<img src="http://zaru.tofu-kun.org/?ak_action=api_record_view&id=343&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://zaru.tofu-kun.org/2011/04/28/cakephp%e3%81%a7%e3%80%81mysql%e3%81%a8postgresql%e4%b8%a1%e6%96%b9%e3%82%92%e4%bd%bf%e3%81%84%e3%81%a4%e3%81%a4%e3%80%81%e3%81%95%e3%82%89%e3%81%ab%e9%81%95%e3%81%86%e6%96%87%e5%ad%97%e3%82%b3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://zaru.tofu-kun.org/2011/04/28/cakephp%e3%81%a7%e3%80%81mysql%e3%81%a8postgresql%e4%b8%a1%e6%96%b9%e3%82%92%e4%bd%bf%e3%81%84%e3%81%a4%e3%81%a4%e3%80%81%e3%81%95%e3%82%89%e3%81%ab%e9%81%95%e3%81%86%e6%96%87%e5%ad%97%e3%82%b3/" />
	</item>
		<item>
		<title>CakePHP+PostgreSQLで、relation &#8216;hoge&#8217; does not existって怒られたときの対処法</title>
		<link>http://zaru.tofu-kun.org/2011/04/18/cakephppostgresql%e3%81%a7%e3%80%81relation-hoge-does-not-exist%e3%81%a3%e3%81%a6%e6%80%92%e3%82%89%e3%82%8c%e3%81%9f%e3%81%a8%e3%81%8d%e3%81%ae%e5%af%be%e5%87%a6%e6%b3%95/</link>
		<comments>http://zaru.tofu-kun.org/2011/04/18/cakephppostgresql%e3%81%a7%e3%80%81relation-hoge-does-not-exist%e3%81%a3%e3%81%a6%e6%80%92%e3%82%89%e3%82%8c%e3%81%9f%e3%81%a8%e3%81%8d%e3%81%ae%e5%af%be%e5%87%a6%e6%b3%95/#comments</comments>
		<pubDate>Mon, 18 Apr 2011 08:31:53 +0000</pubDate>
		<dc:creator>zaru</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[MySQL_PostgreSQL]]></category>
		<category><![CDATA[プログラミング_PHP]]></category>

		<guid isPermaLink="false">http://zaru.tofu-kun.org/?p=340</guid>
		<description><![CDATA[基本的に僕はCakePHP + MySQLの組み合わせで運用しているので、PostgreSQLでの運用経験がなく、基本的なところでつまずいてしまう。 今回は、データを save しようとしたら出たエラー「relation &#8216;hoge&#8217; does not exist」。実行しているSQLを確認すると…。 SELECT currval('hoge_did_sequence') as max あー、しまった。プライマリーキー用のシーケンス名が違うからか。というわけでモデルに var $sequence = '名前'; と設定してあげることで大丈夫です。]]></description>
			<content:encoded><![CDATA[<p>基本的に僕はCakePHP + MySQLの組み合わせで運用しているので、PostgreSQLでの運用経験がなく、基本的なところでつまずいてしまう。</p>
<p>今回は、データを save しようとしたら出たエラー「relation &#8216;hoge&#8217; does not exist」。実行しているSQLを確認すると…。</p>
<pre class="brush: sql; title: ;">SELECT currval('hoge_did_sequence') as max</pre>
<p>あー、しまった。プライマリーキー用のシーケンス名が違うからか。というわけでモデルに</p>
<pre class="brush: php; title: ;">var $sequence = '名前';</pre>
<p>と設定してあげることで大丈夫です。</p>
<img src="http://zaru.tofu-kun.org/?ak_action=api_record_view&id=340&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://zaru.tofu-kun.org/2011/04/18/cakephppostgresql%e3%81%a7%e3%80%81relation-hoge-does-not-exist%e3%81%a3%e3%81%a6%e6%80%92%e3%82%89%e3%82%8c%e3%81%9f%e3%81%a8%e3%81%8d%e3%81%ae%e5%af%be%e5%87%a6%e6%b3%95/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://zaru.tofu-kun.org/2011/04/18/cakephppostgresql%e3%81%a7%e3%80%81relation-hoge-does-not-exist%e3%81%a3%e3%81%a6%e6%80%92%e3%82%89%e3%82%8c%e3%81%9f%e3%81%a8%e3%81%8d%e3%81%ae%e5%af%be%e5%87%a6%e6%b3%95/" />
	</item>
		<item>
		<title>CakePHPで404ページをまとめて301転送する方法</title>
		<link>http://zaru.tofu-kun.org/2011/02/17/cakephp%e3%81%a7404%e3%83%9a%e3%83%bc%e3%82%b8%e3%82%92%e3%81%be%e3%81%a8%e3%82%81%e3%81%a6301%e8%bb%a2%e9%80%81%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95/</link>
		<comments>http://zaru.tofu-kun.org/2011/02/17/cakephp%e3%81%a7404%e3%83%9a%e3%83%bc%e3%82%b8%e3%82%92%e3%81%be%e3%81%a8%e3%82%81%e3%81%a6301%e8%bb%a2%e9%80%81%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95/#comments</comments>
		<pubDate>Thu, 17 Feb 2011 01:48:24 +0000</pubDate>
		<dc:creator>zaru</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[プログラミング_PHP]]></category>
		<category><![CDATA[技術その他]]></category>

		<guid isPermaLink="false">http://zaru.tofu-kun.org/?p=302</guid>
		<description><![CDATA[ちょっとした自分用メモレベルで失礼。 HTTPステータスコードが404 Not Foundのページを、301 Moved Permanentlyでトップページにリダイレクトをかける方法は、下記のようにmod_rewriteを使えば簡単にできるのだけど、CakePHPの場合はwebrootディレクトリ直下の.htaccessで、同様のことをindex.phpにパラメータを渡して、例のURLを実現しているので使えない。 シンプルなやり方 RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ / [R=301,L] CakePHP用 appディレクトリ直下に error.php を作成し、404の時にheader()で301リダイレクトをかけるだけ。 class AppError extends ErrorHandler { function error404() { header(&#34;HTTP/1.1 301 Moved Permanently&#34;); header(&#34;Location: http://www.example.com/&#34;); } } 本当は、素直に404 Not Found専用のページを作るのが良いんだけど、案件によって必要だったので。]]></description>
			<content:encoded><![CDATA[<p>ちょっとした自分用メモレベルで失礼。</p>
<p>HTTPステータスコードが404 Not Foundのページを、301 Moved Permanentlyでトップページにリダイレクトをかける方法は、下記のようにmod_rewriteを使えば簡単にできるのだけど、CakePHPの場合はwebrootディレクトリ直下の.htaccessで、同様のことをindex.phpにパラメータを渡して、例のURLを実現しているので使えない。</p>
<h4>シンプルなやり方</h4>
<pre class="brush: bash; title: ;">
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ / [R=301,L]
</pre>
<h4>CakePHP用</h4>
<p>appディレクトリ直下に error.php を作成し、404の時にheader()で301リダイレクトをかけるだけ。</p>
<pre class="brush: php; title: ;">
class AppError extends ErrorHandler {

	function error404() {
		header(&quot;HTTP/1.1 301 Moved Permanently&quot;);
		header(&quot;Location: http://www.example.com/&quot;);
	}

}
</pre>
<p>本当は、素直に404 Not Found専用のページを作るのが良いんだけど、案件によって必要だったので。</p>
<img src="http://zaru.tofu-kun.org/?ak_action=api_record_view&id=302&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://zaru.tofu-kun.org/2011/02/17/cakephp%e3%81%a7404%e3%83%9a%e3%83%bc%e3%82%b8%e3%82%92%e3%81%be%e3%81%a8%e3%82%81%e3%81%a6301%e8%bb%a2%e9%80%81%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://zaru.tofu-kun.org/2011/02/17/cakephp%e3%81%a7404%e3%83%9a%e3%83%bc%e3%82%b8%e3%82%92%e3%81%be%e3%81%a8%e3%82%81%e3%81%a6301%e8%bb%a2%e9%80%81%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95/" />
	</item>
		<item>
		<title>CakePHP ホスト名でviewsのディレクトリを切り替える</title>
		<link>http://zaru.tofu-kun.org/2011/01/07/cakephp-%e3%83%9b%e3%82%b9%e3%83%88%e5%90%8d%e3%81%a7views%e3%81%ae%e3%83%87%e3%82%a3%e3%83%ac%e3%82%af%e3%83%88%e3%83%aa%e3%82%92%e5%88%87%e3%82%8a%e6%9b%bf%e3%81%88%e3%82%8b/</link>
		<comments>http://zaru.tofu-kun.org/2011/01/07/cakephp-%e3%83%9b%e3%82%b9%e3%83%88%e5%90%8d%e3%81%a7views%e3%81%ae%e3%83%87%e3%82%a3%e3%83%ac%e3%82%af%e3%83%88%e3%83%aa%e3%82%92%e5%88%87%e3%82%8a%e6%9b%bf%e3%81%88%e3%82%8b/#comments</comments>
		<pubDate>Fri, 07 Jan 2011 10:56:01 +0000</pubDate>
		<dc:creator>zaru</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[プログラミング_PHP]]></category>

		<guid isPermaLink="false">http://zaru.tofu-kun.org/?p=280</guid>
		<description><![CDATA[Virtual Hostで複数のドメインを一つのサーバで、しかもCakePHPも使い回したい。ということで、viewの（viewだけじゃなくcontrollerやmodelも）ディレクトリ構成をホスト名毎に切り替える方法。実に簡単なマニュアルレベル。 /app/config/bootstrap.php App::build(array( 'views' =&#62; array( ROOT.DS.APP_DIR.DS.'views'.DS.$_SERVER['HTTP_HOST'].DS, ROOT.DS.APP_DIR.DS.'views'.DS, ), )); こうすれば /app/views/www.example-a.com/ /app/views/www.example-b.com/ で、それぞれ使い分けることが可能。]]></description>
			<content:encoded><![CDATA[<p>Virtual Hostで複数のドメインを一つのサーバで、しかもCakePHPも使い回したい。ということで、viewの（viewだけじゃなくcontrollerやmodelも）ディレクトリ構成をホスト名毎に切り替える方法。実に簡単なマニュアルレベル。</p>
<h4>/app/config/bootstrap.php</h4>
<pre class="brush: php; title: ;">
App::build(array(
    'views' =&gt; array(
        ROOT.DS.APP_DIR.DS.'views'.DS.$_SERVER['HTTP_HOST'].DS,
        ROOT.DS.APP_DIR.DS.'views'.DS,
    ),
));
</pre>
<p>こうすれば</p>
<p>/app/views/www.example-a.com/<br />
/app/views/www.example-b.com/</p>
<p>で、それぞれ使い分けることが可能。</p>
<img src="http://zaru.tofu-kun.org/?ak_action=api_record_view&id=280&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://zaru.tofu-kun.org/2011/01/07/cakephp-%e3%83%9b%e3%82%b9%e3%83%88%e5%90%8d%e3%81%a7views%e3%81%ae%e3%83%87%e3%82%a3%e3%83%ac%e3%82%af%e3%83%88%e3%83%aa%e3%82%92%e5%88%87%e3%82%8a%e6%9b%bf%e3%81%88%e3%82%8b/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://zaru.tofu-kun.org/2011/01/07/cakephp-%e3%83%9b%e3%82%b9%e3%83%88%e5%90%8d%e3%81%a7views%e3%81%ae%e3%83%87%e3%82%a3%e3%83%ac%e3%82%af%e3%83%88%e3%83%aa%e3%82%92%e5%88%87%e3%82%8a%e6%9b%bf%e3%81%88%e3%82%8b/" />
	</item>
		<item>
		<title>CakePHPをPHP5.3で使うとエラーになる時の対処法</title>
		<link>http://zaru.tofu-kun.org/2010/03/10/cakephp%e3%82%92php5-3%e3%81%a7%e4%bd%bf%e3%81%86%e3%81%a8%e3%82%a8%e3%83%a9%e3%83%bc%e3%81%ab%e3%81%aa%e3%82%8b%e6%99%82%e3%81%ae%e5%af%be%e5%87%a6%e6%b3%95/</link>
		<comments>http://zaru.tofu-kun.org/2010/03/10/cakephp%e3%82%92php5-3%e3%81%a7%e4%bd%bf%e3%81%86%e3%81%a8%e3%82%a8%e3%83%a9%e3%83%bc%e3%81%ab%e3%81%aa%e3%82%8b%e6%99%82%e3%81%ae%e5%af%be%e5%87%a6%e6%b3%95/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 09:03:02 +0000</pubDate>
		<dc:creator>zaru</dc:creator>
				<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[プログラミング_PHP]]></category>

		<guid isPermaLink="false">http://zaru.tofu-kun.org/?p=154</guid>
		<description><![CDATA[PHP5.3だとエラーが色々と… PHP5.1からPHP5.3へアップデートをすると、CakePHP1.2においてエラーが出てしまったので、その場合の対処法。 Deprecatedエラーが出る Deprecated: Assigning the return value of new by reference is deprecated in云々なエラー。 cake/libs/configure.php (295行目付近） if (isset($config['debug'])) { if ($_this-&#62;debug) { error_reporting(E_ALL); //下記追加 if (error_reporting() &#62; 6143) { error_reporting(E_ALL &#38; ~E_DEPRECATED); } //ここまで strtotime()でタイムゾーンのエラーが出る Warning: strtotime() [http://php.net/function.strtotime]: It is not safe to rely on the system’s timezone settings.というエラー。 /etc/php.ini [Date] ; Defines the [...]]]></description>
			<content:encoded><![CDATA[<h3>PHP5.3だとエラーが色々と…</h3>
<p>PHP5.1からPHP5.3へアップデートをすると、CakePHP1.2においてエラーが出てしまったので、その場合の対処法。</p>
<h3>Deprecatedエラーが出る</h3>
<p>Deprecated: Assigning the return value of new by reference is deprecated in云々なエラー。</p>
<ul>
<li>cake/libs/configure.php (295行目付近）</li>
</ul>
<pre class="brush: php; title: ;">
if (isset($config['debug'])) {
	if ($_this-&gt;debug) {
		error_reporting(E_ALL);
		//下記追加
		if (error_reporting() &gt; 6143) {
			error_reporting(E_ALL &amp; ~E_DEPRECATED);
		}
		//ここまで
</pre>
<h3>strtotime()でタイムゾーンのエラーが出る</h3>
<p>Warning: strtotime() [http://php.net/function.strtotime]: It is not safe to rely on the system’s timezone settings.というエラー。</p>
<ul>
<li>/etc/php.ini</li>
</ul>
<pre class="brush: bash; title: ;">
[Date]
; Defines the default timezone used by the date functions
;date.timezone =
date.timezone =Asia/Tokyo
</pre>
<p>と、タイムゾーンを設定してやれば大丈夫。</p>
<img src="http://zaru.tofu-kun.org/?ak_action=api_record_view&id=154&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://zaru.tofu-kun.org/2010/03/10/cakephp%e3%82%92php5-3%e3%81%a7%e4%bd%bf%e3%81%86%e3%81%a8%e3%82%a8%e3%83%a9%e3%83%bc%e3%81%ab%e3%81%aa%e3%82%8b%e6%99%82%e3%81%ae%e5%af%be%e5%87%a6%e6%b3%95/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://zaru.tofu-kun.org/2010/03/10/cakephp%e3%82%92php5-3%e3%81%a7%e4%bd%bf%e3%81%86%e3%81%a8%e3%82%a8%e3%83%a9%e3%83%bc%e3%81%ab%e3%81%aa%e3%82%8b%e6%99%82%e3%81%ae%e5%af%be%e5%87%a6%e6%b3%95/" />
	</item>
	</channel>
</rss>

