Web系のこととかー。

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->debug) {
		error_reporting(E_ALL);
		//下記追加
		if (error_reporting() > 6143) {
			error_reporting(E_ALL & ~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 default timezone used by the date functions
;date.timezone =
date.timezone =Asia/Tokyo

と、タイムゾーンを設定してやれば大丈夫。

§154 · 3月 10, 2010 · CakePHP, プログラミング_PHP · · [Print]

1 Comment to “CakePHPをPHP5.3で使うとエラーになる時の対処法”

  1. [...] CakePHPをPHP5.3で使うとエラーになる時の対処法 | zaru blog [...]

Leave a Reply