CentOS4.6+MySQL 4.0.26

参った。


RPMでインストール自体は出来るのだが・・・

# rpm -ivh ./MySQL-server-4.0.26-0.i386.rpm 
Preparing...                ########################################### [100%]
   1:MySQL-server           ########################################### [100%]
Preparing db table
Preparing host table
Preparing user table
Preparing func table
Preparing tables_priv table
Preparing columns_priv table
Installing all prepared tables
Fatal error: Can't change to run as user 'mysql'.  Please check that the user exists!
091130  7:05:11 Aborting

091130  7:05:11 /usr/sbin/mysqld: Shutdown Complete

Installation of grant tables failed!

Examine the logs in /var/lib/mysql for more information.
You can also try to start the mysqld daemon with:
/usr/sbin/mysqld --skip-grant &
You can use the command line tool
/usr/bin/mysql to connect to the mysql
database and look at the grant tables:

shell> /usr/bin/mysql -u root mysql
mysql> show tables

Try 'mysqld --help' if you have problems with paths. Using --log
gives you a log in /var/lib/mysql that may be helpful.

The latest information about MySQL is available on the web at
http://www.mysql.com
Please consult the MySQL manual section: 'Problems running mysql_install_db',
and the manual section that describes problems on your OS.
Another information source is the MySQL email archive.
Please check all of the above before mailing us!
And if you do mail us, you MUST use the /usr/bin/mysqlbug script!


途中でエラーが出て、MySQLが起動出来ない・・・


4.1系ならインストールも起動も出来るのだが、4.0系→4.1系でデータ型やら、ちょっと変わった部分があるので、そのままデータを移行出来ないのです。


色々調べてみたのだが、回避方法が見つからない。。。orz


4.0系の最新バージョンを入れようとしたのだが、もう、4.0系が公開されていないので、入れようもないのです。


色々やってみるか。。


でわ。

USBメモリ+UniformServer+Starbug1でポータブルBTS環境を構築

さて、気軽に使えるBTSシステムである、Starbug1USBメモリに入れ、持ち運べるようにしてみました。


ミドルウェア環境は、UniformServerを使います。
※WAMPです


以下、簡単な流れです。

1) USBメモリを準備、端末に接続
  → 今回はFドライブとしました
2) UniformServerをダウンロード
  → http://www.uniformserver.com/
3) UniformServerをインストール
  → インストール先はUSBメモリを指定
   → F:\UniServer へインストールされる
4) Starbug1をダウンロード
  → http://starbug1.sourceforge.jp/
5) ダウンロードしたStarbug1をドキュメントルートに展開する
  → F:\UniServer\www\starbug1
6) httpd.conf を修正する
  → F:\UniServer\usr\local\apache2\conf\httpd.conf
   → ExecCGIを追記して、CGIを動作させる
7) UniformServerを起動する
  → Start_Server.bat を実行
8) ブラウザにてアクセス
  → http://localhost/starbug1/index.cgi

これでポータブルBTS環境の構築は完了。


USBメモリさえあれば、会社でも家でも同じBTSが使えます。
自分用のタスク管理に良いかもですね。


でわ。

CentOS4.6+Java 1.4.2.01

ちょっと、古い環境を構築せねばならない事となり。


CentOS4.6 に Java1.4.2.01 を入れようとしたのですが・・・


Sunのサイトより、Linux版のパッケージをダウンロード。
j2sdk-1_4_2_01-linux-i586-rpm.bin
んでもって、RPMを作るべく、実行するのだが・・・

# chown 755 ./j2sdk-1_4_2_01-linux-i586-rpm.bin
# ./j2sdk-1_4_2_01-linux-i586-rpm.bin
                           Sun Microsystems, Inc.
                        Binary Code License Agreement

                                   for the

JAVATM 2 SOFTWARE DEVELOPMENT KIT (J2SDK), STANDARD EDITION, VERSION 1.4.2_X
(snip)
For inquiries please contact: Sun Microsystems, Inc., 4150 Network Circle,
Santa Clara, California 95054, U.S.A.
(LFI#130039/Form ID#011801)

Do you agree to the above license terms? [yes or no] 
yes
Unpacking...
tail: cannot open `+473' for reading: No such file or directory
Checksumming...
1
The download file appears to be corrupted.  Please refer
to the Troubleshooting section of the Installation
Instructions on the download page for more information.

あれ・・・?
RPMが作れない。


色々調べたところ、カーネルのバージョンが新しすぎる事が原因でした。

なので、検証機で置いてあった、CentOS4.2にてRPMを作成。

# ./j2sdk-1_4_2_01-linux-i586-rpm.bin 
                           Sun Microsystems, Inc.
                        Binary Code License Agreement

                                   for the

JAVATM 2 SOFTWARE DEVELOPMENT KIT (J2SDK), STANDARD EDITION, VERSION 1.4.2_X
(snip)
For inquiries please contact: Sun Microsystems, Inc., 4150 Network Circle,
Santa Clara, California 95054, U.S.A.
(LFI#130039/Form ID#011801)

Do you agree to the above license terms? [yes or no] 
yes
Unpacking...
Checksumming...
0
0
Extracting...
UnZipSFX 5.40 of 28 November 1998, by Info-ZIP (Zip-Bugs@lists.wku.edu).
  inflating: j2sdk-1_4_2_01-linux-i586.rpm  
Done.

おk。


CentOS4.6 の環境にRPMFTP転送して、インストール完了。


ちょっとハマったw


解決出来て良かった。


でわ。

java.sql.SQLException: Communication link failure: java.io.IOException

このエラーが取れない。

Oct 28, 2009 9:32:42 AM org.apache.jk.server.JkCoyoteHandler action
INFO: RESET
java.sql.SQLException: Communication link failure: java.io.IOException
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1604)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:886)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:945)
        at com.mysql.jdbc.MysqlIO.sqlQuery(MysqlIO.java:917)
        at com.mysql.jdbc.Connection.execSQL(Connection.java:1841)
        at com.mysql.jdbc.Connection.execSQL(Connection.java:1775)
        at com.mysql.jdbc.Statement.executeQuery(Statement.java:1220)
(snip)

発生するトリガーも不明。


Tomcat動かして、2,3日すると発生する模様。


う〜ん・・・


頑張って調べよう。


でわ。

IEでの納品書PDF表示障害(Ver2.4.0)

管理画面の受注管理の検索一覧より、各受注の帳票をPDFで出力する事が出来ます。

さて、その帳票(納品書)をダウンロードせずに、ブラウザからPDFを開いた場合、IEだとエラーが発生し、表示出来ません。


こんなエラーメッセージが出ます。
「この文書を開くときにエラーが発生しました。ファイルが壊れています。修復できませんでした。」


この障害を回避する為には、
data/pdf/fpdf.php
を以下のよう編集する必要があります。

/* 1024行目付近 */
switch($dest)
{
	case 'I':
		//Send to standard output
		if(ob_get_contents())
			$this->Error('Some data has already been output, can\'t send PDF file');
		if(php_sapi_name()!='cli')
		{
			//We send to a browser
			header('Content-Type: application/pdf');
			if(headers_sent())
				$this->Error('Some data has already been output to browser, can\'t send PDF file');
// IEでPDFを表示出来るように追加 Start
			header('Cache-Control: ');
			header('Pragma: ');
// IEでPDFを表示出来るように追加 End
			header('Content-Length: '.strlen($this->buffer));
			header('Content-disposition: inline; filename="'.$name.'"');
		}
		echo $this->buffer;
		break;
	case 'D':
		//Download file
		if(ob_get_contents())
			$this->Error('Some data has already been output, can\'t send PDF file');
		if(isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'],'MSIE'))
			header('Content-Type: application/force-download');
		else
			header('Content-Type: application/octet-stream');
		if(headers_sent())
			$this->Error('Some data has already been output to browser, can\'t send PDF file');
// IEでPDFを表示出来るように追加 Start
		header('Cache-Control: ');
		header('Pragma: ');
// IEでPDFを表示出来るように追加 End
		header('Content-Length: '.strlen($this->buffer));
		header('Content-disposition: attachment; filename="'.$name.'"');
		echo $this->buffer;
		break;
	case 'F':
		//Save to local file
		$f=fopen($name,'wb');
		if(!$f)
			$this->Error('Unable to create output file: '.$name);
		fwrite($f,$this->buffer,strlen($this->buffer));
		fclose($f);
		break;
	case 'S':
		//Return as a string
		return $this->buffer;
	default:
		$this->Error('Incorrect output destination: '.$dest);
}

これで、IEでも正常に納品書PDFが表示出来ました。


でわ。

Apache起動障害(Unclean shutdown of previous Apache run?)

さて、久々にとある案件のサーバを触ったところ、Apacheが起動しなくなりました。


pidファイルは作成されるが、Apacheのプロセスが起動しない。


エラーログを見たところ、以下エラーが出てました。

[warn] pid file /usr/local/apache/logs/httpd.pid overwritten -- Unclean shutdown of previous Apache run?


pidファイルを削除して再度Apacheを起動させてもダメ。
pidファイルのパーミッションを変えてもダメ。
サーバ自体の再起動をやってもダメ。


色々とサーバの中を探っていたところ、PHPのログがかなり肥大化してました。
※500MBくらい

php.iniの中のこの設定のログ
; Log errors to specified file.
error_log = /var/log/php_err.log


もしやと思い、php_err.log を削除してApacheを再起動すると・・・


成功!!


いやぁ・・・
結構ハマったなぁ。。。


でわ。