cakePHPを使った解析ツール新サーバーへ移行

Last-modified: 2014-11-21 (金) 10:06:15

apacheのconf置き場
/etc/httpd/conf.d

ログ置き場
/var/log/httpd/

php.ini置き場
/etc/php.ini

apach起動
/etc/init.d/httpd start

mysql起動
/etc/init.d/mysql start

解析用の新しいconfを作成
/etc/httpd/conf.d/analyze.conf

中身はコレ


IP ADDRESS BASED VIRTUAL HOST

#NameVirtualHost

VIRTUAL HOST CONFIGURATION

ServerName saws-01.bg.mkb.local
DocumentRoot "/home/swan_analyze/htdocs"
ErrorLog /home/swan_analyze/logs/error_log
CustomLog /home/swan_analyze/logs/access_log combined


新サーバーはPHP5.3だったため、cakePHPがエラーを出しまくった。
PHP Deprecated: Assigning the return value of new by reference is deprecated in ...

そこで、cake/libs/configure.phpの290行目あたりに下記の処理を入れればDeprecatedエラーが出なくなる。

if (isset($config['debug'])) {
if($_this->debug) {
error_reporting(E_ALL);
if (error_reporting() > 6143) {
error_reporting(E_ALL & ~E_DEPRECATED);
}

ついでに、php.iniでのerror_reportingは「E_ALL | E_STRICT」にしてるけど、CakePHPではE_STRICTが出て嫌だという場合には、httpd.confまたは.htaccessにてCakeのディレクトリのみ下記のようにerror_reportingを設定すればOK。(この値はPHP5.3の場合)
php_value error_reporting 22527

たとえば、ereg()を使うとエラーがでて、
(かわりに preg_match() を使用すると消える。

次は、「Warning: strtotime() [http://php.net/function.strtotime]: It is not safe to rely on the system’s timezone settings.」と出るので調べると、timezoneの設定の問題のようです。

なので、「php.ini」の「date.timezone」を修正しました。

;date.timezone =
 ↓
date.timezone =Asia/Tokyo

apach再起動が必要!