noshi’s diary

ゲームの事、映画やドラマ、思いついた事、プログラミングの事、雑記的なことを書いています

phpバージョンアップしてみた

phpのバージョンアップをしてみました。 5.1から5.3へのバージョンアップ。

wget -q -O - http://www.atomicorp.com/installers/atomic.sh | sh

yum update php

上記実行後、いくつかエラーが発生しました。 まず、ほとんどのページで確認されたエラーは、以下。 [Mon Jun 14 00:11:45 2010] [error] [client xxx.xxx.xxx.xxx.xxx] PHP Warning: strftime() [function.strftime]: It is not safe to rely on the system's timezone settings. You are required to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Tokyo' for 'JST/9.0/no DST' instead in ・・・・ そして一部ページでこんなエラーも。 Fatal error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' まず、ひとつめのエラーはtimezoneに関するもの。 php.iniの設定を変更すればよいかな。 ただ、一つ注意点があります。 upgradeにより、php.ini.rpmnewというバージョンアップ後のphp.iniが/etc/以下にできています。 もちろん、以前のphp.iniは上書きはされていません。 なので、これまでのphp.iniの設定がわからなくなるので、php.iniの複製をつくっておきます。 こんな感じで。

cp php.ini php.ini.buckup

それから、

mv /etc/php.ini.rpmnew /etc/php.ini

とします。 その後に、php.iniの中のtimezoneに関する部分を変更します。 --------- [Date] ; Defines the default timezone used by the date functions ; http://php.net/date.timezone date.timezone = "Asia/Tokyo" --------- すると、上の長いエラーは消えました。 また、今までのphp.iniにpearのパスを通していれば、この部分も変更が必要なので変更しておきます。 (php.iniの設定) include_path = ".:/php/includes:/usr/share/pear" 次に、mysqlのエラーですが、sockが無い主旨のエラーでしたので、

touch /var/lib/mysql/mysql.sock

でsockをつくりエラー回避。 あと、mysqlも同時に5.5にアップグレード。 すると、 [ERROR] /usr/libexec/mysqld: unknown variable ‘default-character-set=utf8′ のエラー。 /etc/my.cnfの文字コードに関する部分も一部変更 「default-character-set」→ character-set-server=utf8 これでほぼ元通り。