バージョン選択

フォーラム

メニュー

オンライン状況

72 人のユーザが現在オンラインです。 (64 人のユーザが フォーラム を参照しています。)
登録ユーザ: 0
ゲスト: 72
もっと...

サイト内検索

質問 > その他 > MySQL からPostgreSQL へ移行後に、急に500エラーになった件について

その他

新規スレッドを追加する

スレッド表示 | 新しいものから 前のトピック | 次のトピック | 下へ
投稿者 スレッド
saki1982
投稿日時: 2010/4/19 22:05
対応状況: −−−
新米
登録日: 2010/4/19
居住地:
投稿: 3
MySQL からPostgreSQL へ移行後に、急に500エラーになった件について


EC-CUBE2.4 を利用しており、先日、MySQL5からPostgreSQL8へ
移行しましたが、しばらくは問題なかったのですが、
急に、ECトップページにアクセスすると、500エラーになりました。
通常のHTMLファイルには問題なくアクセス出来ており、
.php ファイルが500エラーという状態です。

Apache2のエラーログを見ると、以下のログがありましたが、
解決策はございますでしょうか?


PHP Fatal error: Call to undefined method DB_Error::getCol() in /パス/eccube/data/class/SC_DbConn.php on line 139

suEXEC mechanism enabled (wrapper: /usr/local/apache2

Apache/2.2.11 (Unix) DAV/2 PHP/5.2.9 with Suhosin-Patch mod_ssl/2.2.11 OpenSSL/0.9.7m mod_apreq2-20051231/2.6.0 mod_perl/2.0.3 Perl/v5.8.7 configured -- resuming normal operations


msa
投稿日時: 2010/4/20 2:20
対応状況: −−−
新米
登録日: 2010/4/18
居住地: 福岡県福岡市
投稿: 10
Re: MySQL からPostgreSQL へ移行後に、急に500エラーになった件について
PostgreSQLサーバーはダウンしていませんか?

以下参考にるかと思いますのでご参照ください。

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

恐らくCGI版で動作させているので500エラーだと思うのですが
本質は同じだと思います。


saki1982
投稿日時: 2010/4/20 7:55
対応状況: −−−
新米
登録日: 2010/4/19
居住地:
投稿: 3
Re: MySQL からPostgreSQL へ移行後に、急に500エラーになった件について
ありがとうございます。
PostgreSQLは、何回か再起動しましたので、ダウンはしていないと思います。

(ログからすると)
http://phplens.com/adodb/reference.functions.getcol.html
の設定が足りない様な気がするのですが、いかがでしょうか?

http://phplens.com/adodb/reference.functions.getcol.html
は、初めて見るので、どう設定していいのか分かりません。

何かご存知でしょうか?
多分、今、中後半端に、旧データベースのMySQLを読み込んでいる気がします・・・・




調査する限りですと、GetColは、PearのDB_commonでご利用可能で、
GetColはインストールというものではなくget関数の内の1つだそうですが、こちらは、どうやったり利用可能になるのでしょうか?






msa
投稿日時: 2010/4/20 19:06
対応状況: −−−
新米
登録日: 2010/4/18
居住地: 福岡県福岡市
投稿: 10
Re: MySQL からPostgreSQL へ移行後に、急に500エラーになった件について
saki1982さんお疲れ様です。

SQLサーバーの方はOKだったんですね。

SQLサーバーを移行後に正常動作を確認されていることですし
saki1982さんの方で何もしていない状況で500エラーが発生と解釈
しましたのでSQLサーバーのダウンが怪しいかなと思った次第です。

確かにログのエラーは「DB_Error::〜」となっているのでREARで不具合が発生していると思います。

移行後にロジックなどのソースに変更を加えていないのでしたら
やはりMySQL から postgreSQLの変更に伴うDBの接続エラーが
一番疑いたくなりますよね。

/data/install.phpなどの設定を今一度見直してみてはいかがでしょうか?

またデバッグモードでPEARのエラーログがチェック出来れば良いのですが環境によっては吐かない場合もあるようです。

saki1982
投稿日時: 2010/4/20 19:55
対応状況: −−−
新米
登録日: 2010/4/19
居住地:
投稿: 3
Re: MySQL からPostgreSQL へ移行後に、急に500エラーになった件について


ありがとうございます。
/data/index.php ですが、以下です。



<?php
define ('ECCUBE_INSTALL', 'ON');
define ('HTML_PATH', '/パス/eccube/html/');
define ('SITE_URL', 'http://ドメイン/eccube/html/');
define ('SSL_URL', 'http://ドメイン/eccube/html/');
define ('URL_DIR', '/eccube/html/');
define ('DOMAIN_NAME', 'ドメイン');
define ('DB_TYPE', 'pgsql');
define ('DB_USER', 'admin');
define ('DB_PASSWORD', 'パスワード');
define ('DB_SERVER', 'localhost');
define ('DB_NAME', 'データベース名');
define ('DB_PORT', '5432');
define ('DATA_PATH', '/パス/eccube/data/');
define ('MOBILE_HTML_PATH', HTML_PATH . 'mobile/');
define ('MOBILE_SITE_URL', SITE_URL . 'mobile/');
define ('MOBILE_SSL_URL', SSL_URL . 'mobile/');
define ('MOBILE_URL_DIR', URL_DIR . 'mobile/');
?>



あと、一応、php.ini も添付させて頂きます。


error_reporting = E_ALL

; Print out errors (as a part of the output). For production web sites,
; you're strongly encouraged to turn this feature off, and use error logging
; instead (see below). Keeping display_errors enabled on a production web site
; may reveal security information to end users, such as file paths on your Web
; server, your database schema or other information.
;
; possible values for display_errors:
;
; Off - Do not display any errors
; stderr - Display errors to STDERR (affects only CGI/CLI binaries!)
; On or stdout - Display errors to STDOUT (default)
;
; To output errors to STDERR with CGI/CLI:
;display_errors = "stderr"
;

^G Get Help ^O WriteOut ^R Read File ^Y Prev Pg ^K Cut Text ^C Cur Pos
^X Exit ^J Justify ^W Where is ^V Next Pg ^U UnCut Text^T To Spell
UW PICO 5.04 File: php.ini Modified


; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
;upload_tmp_dir =

; Maximum allowed size for uploaded files.
upload_max_filesize = 2M


;;;;;;;;;;;;;;;;;;
; Fopen wrappers ;
;;;;;;;;;;;;;;;;;;

; Whether to allow the treatment of URLs (like http:// or ftp://) as files.
allow_url_fopen = On

; Whether to allow include/require to open URLs (like http:// or ftp://) as files.
allow_url_include = Off

; Define the anonymous ftp password (your email address)
;from="john@doe.com";

; Define the User-Agent string
; user_agent="PHP"

; Default timeout for socket based streams (seconds)
default_socket_timeout = 60

; If your scripts have to deal with files from Macintosh systems,
; or you are running on a Mac and need to deal with files from
; unix or win32 systems, setting this flag will cause PHP to
; automatically detect the EOL character in those files so that
; fgets() and file() will work regardless of the source of the file.
; auto_detect_line_endings = Off


;;;;;;;;;;;;;;;;;;;;;;
; Dynamic Extensions ;
;;;;;;;;;;;;;;;;;;;;;;
;
; If you wish to have an extension loaded automatically, use the following
; syntax:
;
; extension=modulename.extension
;
; For example, on Windows:
;
; extension=msql.dll
;
; ... or under UNIX:
;
; extension=msql.so
;
; Note that it should be the name of the module only; no directory information
; needs to go here. Specify the location of the extension with the
; extension_dir directive above.


; Windows Extensions

^G Get Help ^O WriteOut ^R Read File ^Y Prev Pg ^K Cut Text ^C Cur Pos
^X Exit ^J Justify ^W Where is ^V Next Pg ^U UnCut Text ^T To Spell








<?php
/*
* This file is part of EC-CUBE
*
* Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
*
* http://www.lockon.co.jp/
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

$current_dir = realpath(dirname(__FILE__));
require_once($current_dir . "/../module/DB.php");
require_once($current_dir . "/util/SC_Utils.php");
require_once($current_dir . "/util/GC_Utils.php");
$objDbConn = "";

class SC_DbConn{

var $conn;
var $result;
var $includePath;
var $error_mail_to;
var $error_mail_title;
var $dsn;
var $err_disp = true;
var $dbFactory;


// コンストラクタ
function SC_DbConn($dsn = "", $err_disp = true, $new = false){
global $objDbConn;

// Debugモード指定
$options['debug'] = PEAR_DB_DEBUG;
// 持続的接続オプション
$options['persistent'] = PEAR_DB_PERSISTENT;

// 既に接続されていないか、新規接続要望の場合は接続する。
if(!isset($objDbConn->connection) || $new) {
if($dsn != "") {
$objDbConn = DB::connect($dsn, $options);
$this->dsn = $dsn;
} else {
if(defined('DEFAULT_DSN')) {
$objDbConn = DB::connect(DEFAULT_DSN, $options);
$this->dsn = DEFAULT_DSN;
} else {
return;
}
}
}
//MySQL文字化け対策(MySQLで文字化けする場合は以下のコメントアウトをはずして動作確認してみてください。)
//if (DB_TYPE == 'mysql') {
// $objDbConn->query('SET NAMES utf8');
//}
$this->conn = $objDbConn;
$this->error_mail_to = DB_ERROR_MAIL_TO;
$this->error_mail_title = DB_ERROR_MAIL_SUBJECT;
$this->err_disp = $err_disp;
$this->dbFactory = SC_DB_DBFactory_Ex::getInstance();
}

// クエリの実行
function query($n ,$arr = "", $ignore_err = false){
// mysqlの場合にはビュー表を変換する
if (DB_TYPE == "mysql") $n = $this->dbFactory->sfChangeMySQL($n);

if ( $arr ) {
$result = $this->conn->query($n, $arr);
} else {
$result = $this->conn->query($n);
}

if ($this->conn->isError($result) && !$ignore_err){
$this->send_err_mail ($result, $n);
}

$this->result = $result;
return $this->result;
}

// 一件のみ取得
function getOne($n, $arr = ""){

// mysqlの場合にはビュー表を変換する
if (DB_TYPE == "mysql") $n = $this->dbFactory->sfChangeMySQL($n);

if ( $arr ) {
$result = $this->conn->getOne($n, $arr);
} else {
$result = $this->conn->getOne($n);
}
if ($this->conn->isError($result)){
$this->send_err_mail ($result ,$n);
}
$this->result = $result;

return $this->result;
}

function getRow($n, $arr = ""){

// mysqlの場合にはビュー表を変換する
if (DB_TYPE == "mysql") $n = $this->dbFactory->sfChangeMySQL($n);

if ( $arr ) {
$result = $this->conn->getRow($n, $arr);
} else {
$result = $this->conn->getRow($n);
}
if ($this->conn->isError($result)){
$this->send_err_mail ($result ,$n);
}
$this->result = $result;
return $this->result;
}

function getCol($n, $col, $arr = "") {

// mysqlの場合にはビュー表を変換する
if (DB_TYPE == "mysql") $n = $this->dbFactory->sfChangeMySQL($n);

if ($arr) {
$result = $this->conn->getCol($n, $col, $arr);
} else {
$result = $this->conn->getCol($n, $col);
}
if ($this->conn->isError($result)) {
$this->send_err_mail($result, $n);
}
$this->result = $result;
return $this->result;
}

// SELECT文の実行結果を全て取得
function getAll($n, $arr = ""){

// mysqlの場合にはビュー表を変換する
if (DB_TYPE == "mysql") $n = $this->dbFactory->sfChangeMySQL($n);

if(PEAR::isError($this->conn)) {
if(ADMIN_MODE){
SC_Utils_Ex::sfErrorHeader("DBへの接続に失敗しました。:" . $this->dsn);
}else{
SC_Utils_Ex::sfErrorHeader("DBへの接続に失敗しました。:");
}
return 0;
}

if ( $arr ){
$result = $this->conn->getAll($n, $arr, DB_FETCHMODE_ASSOC);
} else {
$result = $this->conn->getAll($n, DB_FETCHMODE_ASSOC);
}

if ($this->conn->isError($result)){
$this->send_err_mail ($result, $n);
}
$this->result = $result;

return $this->result;
}

function autoExecute($table_name, $fields_values, $sql_where = null){

if ( $sql_where ) {
$result = $this->conn->autoExecute( $table_name, $fields_values, DB_AUTOQUERY_UPDATE, $sql_where);
} else {
$result = $this->conn->autoExecute( $table_name, $fields_values, DB_AUTOQUERY_INSERT);
}

if ($this->conn->isError($result)){
$this->send_err_mail ($result, $n);
}
$this->result = $result;
return $this->result;
}


function prepare($n){
global $sql;
$sql = $n;
$result = $this->conn->prepare($n);
$this->result = $result;
return $this->result;
}

function execute($n, $obj){
global $sql;
$sql = $n;
$result = $this->conn->execute($n, $obj);
$this->result = $result;
return $this->result;
}

function reset(){
$this->conn->disconnect();
}

function send_err_mail($result, $sql){
$url = '';
$errmsg = '';

if (SC_Utils_Ex::sfIsHTTPS()) {
$url = "https://";
} else {
$url = "http://";
}
$url .= $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];

$errmsg = $url."\n\n";
$errmsg.= "SERVER_ADDR:" . $_SERVER['SERVER_ADDR'] . "\n";
$errmsg.= "REMOTE_ADDR:" . $_SERVER['REMOTE_ADDR'] . "\n";
$errmsg.= "USER_AGENT:" . $_SERVER['HTTP_USER_AGENT'] . "\n\n";
$errmsg.= $sql . "\n";
$errmsg.= $result->message . "\n\n";
$errmsg.= $result->userinfo . "\n\n";

$arrRbacktrace = array_reverse($result->backtrace);

foreach($arrRbacktrace as $backtrace) {
if($backtrace['class'] != "") {
$func = $backtrace['class'] . "->" . $backtrace['function'];
} else {
$func = $backtrace['function'];
}

$errmsg.= $backtrace['file'] . " " . $backtrace['line'] . ":" . $func . "\n";
}

require_once(CLASS_EX_PATH . "page_extends/error/LC_Page_Error_SystemError_Ex.php");

$objPage = new LC_Page_Error_SystemError_Ex();
register_shutdown_function(array($objPage, "destroy"));
$objPage->init();
$objPage->process();

if (DEBUG_MODE == true) {
print('<pre>');
print_r(htmlspecialchars($errmsg, ENT_QUOTES, CHAR_CODE));
print('</pre>');
}

GC_Utils_Ex::gfPrintLog($errmsg);

exit();
}
}

?>
msa
投稿日時: 2010/4/20 23:15
対応状況: −−−
新米
登録日: 2010/4/18
居住地: 福岡県福岡市
投稿: 10
Re: MySQL からPostgreSQL へ移行後に、急に500エラーになった件について
install.phpは見た限りですと伏字部分以外は問題ないと思います。

DBの設定関係は定数で定義していますのでこのファイル以外は特になかったと思います。

あとはPHPがPostgreSQLをSupportしているかどうかの確認と
一旦MySQLに戻してみて正常に動作するかなど

果たしてどの部分でおかしくなったかの切り分けして原因追究して行くのが宜しいかと思います。

頑張って原因追究してみてください。





maggi
投稿日時: 2010/4/23 16:29
対応状況: −−−
長老
登録日: 2010/4/23
居住地: 東京都渋谷区恵比寿西1-16-6
投稿: 157
Re: MySQL からPostgreSQL へ移行後に、急に500エラーになった件について
ちなみに同じサーバ環境でまっさらな状態からEC-CUBEをインストールし、新たに作ったpostgresqlと接続させてみた場合でも同じ現象は起きているでしょうか?
そのあたりも含めて切り分けたほうがいいかもしれません。
スレッド表示 | 新しいものから 前のトピック | 次のトピック | トップ


 



ログイン


EC-CUBE公式 Amazon Payプラグイン

統計情報

総メンバー数は88,886名です
総投稿数は110,000件です

投稿数ランキング

1
seasoft
7367
2
468
3217
3
AMUAMU
2712
4
nanasess
2313
5
umebius
2085
6
yuh
1819
7
h_tanaka
1646
8
red
1570
9
mcontact
1295
10
tsuji
958
11
fukap
907
12
shutta
835
13
tao_s
799
14 ramrun 789
15 karin 689
16 sumida 641
17
homan
633
18 DELIGHT 572
19
patapata
502
20
flealog
485


ネットショップの壺

EC-CUBEインテグレートパートナー

Copyright© EC-CUBE CO.,LTD. All Rights Reserved.