ラベル 自宅サーバー の投稿を表示しています。 すべての投稿を表示
ラベル 自宅サーバー の投稿を表示しています。 すべての投稿を表示

2010年7月17日土曜日

ffmpegのオプション設定 実際の変換結果

CentOS5.5にfmpegをインストールして、実際に変換を行ってみた。
Webに掲載するため、FLVへの変換試験です。

FFmpegのバージョン

FFmpeg version 0.5.2
  libavutil     49.15. 0 / 49.15. 0
  libavcodec    52.20. 1 / 52.20. 1
  libavformat   52.31. 0 / 52.31. 0
  libavdevice   52. 1. 0 / 52. 1. 0
  libavfilter    0. 4. 0 /  0. 4. 0
  libswscale     0. 7. 1 /  0. 7. 1
  libpostproc   51. 2. 0 / 51. 2. 0
元動画(Canon5DMarkⅡのフルハイビジョン映像)
ファイル名:test.mov
コーデック名:H264
フレームレート:30
再生時間:50s
ビットレート:40,309,193
幅:1920
高:1088
音声コーデック:pcm_s16le
音声ビットレート:44100
ファイルの大きさ:256MB
FFmpegのオプション設定
  • 「-i」 インプットファイルを指定
  • 「-b」 変換ビットレートを指定、1000kb/s とkb/sを明示的に指定しないといけなかった。
  • 「-t」 50秒を全てエンコすると膨大な時間を要するので、「-t」オプションで 「20」を指定し、最初から20秒間をエンコすることにする。
  • 「-s」 また、フルハイビジョンでWeb上に公開することは無いと思われるので、「-s」オプションで「640x360」を指定した。
  • 「-ar」 音声ビットレートは明示的に「-ar」で「44100」を指定した。
  • 「-y」 出力ファイルの上書き指定
Test1 1Pass 4000kb/s
ffmpeg -i test.mov -b 4000kb/s -t 20 -s 640x360 -mbd rd -g 20 -ar 44100 -y test_640_4000kb_1pass.flv
Test2 1Pass 2500kb/s

ffmpeg -i test.mov -b 2500kb/s -t 20 -s 640x360 -mbd rd -g 20 -ar 44100 -y test_640_2500kb_1pass.flv
Test31Pass 1400kb/s
ffmpeg -i test.mov -b 1400kb/s -t 20 -s 640x360 -mbd rd -g 20 -ar 44100 -y test_640_1400kb_1pass.flv
Test4 1Pass 800kb/s

ffmpeg -i test.mov -b 800kb/s -t 20 -s 640x360 -mbd rd -g 20 -ar 44100 -y test_640_800kb_1pass.flv

Test5 2Pass 4000kb/s

ffmpeg -i test.mov -b 4000kb/s -t 20 -s 640x360 -mbd rd -g 20 -ar 44100 -pass 2 -passlogfile log -y ta_640_4000kb_2pass.flv

Test6 2Pass 2500kb/s

ffmpeg -i test.mov -b 2500kb/s -t 20 -s 640x360 -mbd rd -g 20 -ar 44100 -pass 2 -passlogfile log -y test_640_2500kb_2pass.flv

Test7 2Pass 1400kb/s

ffmpeg -i test.mov -b 1400kb/s -t 20 -s 640x360 -mbd rd -g 20 -ar 44100 -pass 2 -passlogfile log -y ta_640_1400kb_2pass.flv

Test8 2Pass 800kb/s

ffmpeg -i test.mov -b 800kb/s -t 20 -s 640x360 -mbd rd -g 20 -ar 44100 -pass 2 -passlogfile log -y ta_640_800kb_2pass.flv



結果・考察


----------Test1   Test2  Test3   Test4  Test5  Test6  Test7  Test8
Pass      1     1     1     1     2     2     2     2
BitRate   4000   2500   1400   800   4000   2500   1400   800
大きさ   10.25MB 6.52MB 3.78MB 2.07MB 10.25MB 6.45MB 3.59MB 1.97MB
画質     ++++   +++    +++    +    ++++   +++    +++    +

  • 元画質が良ければ、1Pass も 2Pass も遜色無いし、出力ファイルの大きさにも差が無い
  • 2500kb/sと1400kb/sでは、差があまり見られなかった。1280x 720の場合には差が見られるようだ。
  • 800kb/sまでビットレートを落とすと明らかに画質が低下した。
  • 今回の試験の結果、1Pass、1200-1500kb/sで変換していこうと思う。
FFmpegのオプションは、沢山ありすぎて、まだまだ検討の余地はあると思うが、それよりも、バージョンの違いにより、指定方法が違ったりするのが困ったものだ。

2010年7月16日金曜日

XOOPS Cubeにログインできなくなった。あせりまくり!!

表題のとおり自宅サーバーでサイト運営しているXOOPS Cubeにログイン出来なくなりました。

久しぶりにメンテしようとログインすると、

****さん、ようこそ。ログイン中です
と一瞬表示されるがその後
このエリアへのアクセスは許可されていません。
などと表示されログイン画面に戻ってしまう。

昨年まで運用していたサイトは、メインページがPHPの手書きで、日記などは海外由来のBlogを使用していました。セキュリティー的には殆んどノーガードだったと思います。
そのBlogを殆んどメンテ無しでそのまま放置していたため、ある日、乗っ取られてしまい、ファイルが改ざんされてしまいました。それ以来、システム全体のセキュリティーを強化しようと模索し現在に至っているわけですが、またヤラレタカ!と青くなった次第です。

Googleで調べていると、多くの方が同じような症状になっているようですね。
どうも データベースXOOPSのセッションテーブルがおかしくなっているみたいです。
これを、修復してやると直るみたい。
変な悪戯をされた事ではなさそうです、一安心!

早速、ローカルでphpMyaAminを開き、該当テーブルを確認、やはりエラーが出ています。
コンソールからログイン、MySQLにログイン、続けてXOOPSのデーターベースに接続、そしてリペアーして回復。


実際の手順は・・・
[user@centos ~]# mysql -u root -p
Enter password:   ←パスワード入力
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 28411
Server version: 5.xx Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show databases;
+--------------------+
| Database |
+--------------------+
| iptablelog |
| mysql |
| snort_log |
| xoops |    ←これが目的のデーターベース
+--------------------+
4 rows in set (0.00 sec)

mysql> use xoops
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed

mysql> show tables;
+-------------------------------------+
| Tables_in_xoops |
+-------------------------------------+
| b3defd_altsys_language_constants |
| b3defd_pico_categories |
| b3defd_pico_category_permissions |
| b3defd_pico_content_extras |
| b3defd_pico_content_histories |
| b3defd_pico_content_votes |
| b3defd_pico_contents |
| b3defd_pico_tags |
------------ 中略 --------------
| b3defd_protector_access |
| b3defd_protector_log |
| b3defd_ranks |
| b3defd_session |  ←これが目的のテーブル
| b3defd_smiles |
| b3defd_user_mailjob |
| b3defd_user_mailjob_link |
| b3defd_users |
| b3defd_xoopscomments |
| b3defd_xoopsnotifications |
| search |
+-------------------------------------+
121 rows in set (0.01 sec)

mysql> REPAIR TABLE `b3defd_session`;
+--------------------------+--------+----------+------------------------------------------+
| Table | Op | Msg_type | Msg_text |
+--------------------------+--------+----------+------------------------------------------+
| xoops.b3defd_session | repair | warning | Number of rows changed from 1683 to 1685 |
| xoops.b3defd_session | repair | status | OK |
+--------------------------+--------+----------+------------------------------------------+
2 rows in set (0.03 sec)
これで、修復されました。
早速、phpMyAdminで確認してみると、修復されているようです。次に、ブラウザでログインしてみるとチャンとログインできました。

2010/07/19 追記
データベースのリペアーを行うコマンド「REPAIR TABLE `b3defd_session`;」の「`」が「'」とは違う。
完全に「'」と思っていたため、エラーばかり出てしまう。よくよく見てみると、「`」だった。思い込みは失敗を呼びます。反省!
  • 「'」  quote、single quote、apostrophe
  • 「`」  grave mark、reverse single quote、spacing grave accent、back apostrophe
2010/07/26 追記
データベースのチェックと修復についてもう少し詳しく調べてみた。
MySQLのマニュアルから
そのものずばり参考になったサイトとして

Sync A World You Want To Explore

phpmyadmin上からの修復
もっと簡単にphpmyadmin上から修復出来るはずだと思っていましたが、やはり出来ました。
これまで、phpmyadminは使ったことが無かったので調べることもしていなかった。
  • phpmyadminにログイン
  • 該当のデータベースを選択
  • テーブル一覧の下「すべてをチェックする」でチェックする
  • テーブル一覧の下「チェックしたものを:」の「テーブルをチェックする」を選択
  • エラーテーブルをチェックする
  • テーブル一覧の下「チェックしたものを:」の「テーブルを修復する」を選択
以上で終了

2010年7月8日木曜日

ffmpegのオプション設定 動画変換編

映像を他形式へ変換する

MobileHackerz Knowledgebase Wiki を参考に設定してみた。

ffmpeg -i input_file -mbd 1 -g 20 -ar 44100 -y output_file
オプションの説明
  • -i <filename>  インプットファイル名を指定する
  • -mbd <mode>  マクロブロックのモードを決定 : Default = 0
  • -g <gop_size>  GOP(Group Of Picture)のサイズをフレーム数で指定する : Default = 12
  • -ar <rate>  サンプリング周波数 (in Hz)
  • -y   同名ファイルがあった場合アウトプットファイルを上書きする
  • output_file 出力ファイル(拡張子で出力形式を判断しています)
注意点
もう少しトライしてみないと分からない・・・

ffmpegのオプション設定 サムネイル画像編

映像からサムネイル画像を取り出す

MobileHackerz Knowledgebase Wiki を参考に設定してみた。

ffmpeg  -ss  5  -i  input_file  -s  140x100  -f  image2  -vframes  1  -y  output_file
オプションの説明
  • -ss <time_off>  変換開始時間をセットする(hh:mm:ss.ms 又は、s)
  • -i <filename>  インプットファイル名を指定する
  • -s <size>    フレームサイズの設定(WxHか簡略名)数値は必ず偶数で指定する、奇数の場合はエラーが出ます。
  • -f <fmt>    強制的にfmtで指定したフォーマットを適用する(画像として出力)
  • -vframes <number> 変換するビデオフレーム数
  • -y    同名ファイルがあった場合アウトプットファイルを上書きする
  • output_file    出力ファイル(拡張子で出力形式を判断しています) 
注意点
オプション [-ss]の位置は[-i]の前においた方が良いようだ。

2010年7月5日月曜日

TeamViewer5でPort80を閉じる

PCのリモートソフトとして、TeamViewer5 をつかい、2ヵ所のPCを管理している。
このソフトは、Web Serverでよく使われる Port80 をサービスとして起動しているため、ローカルでApache、AN_HTTPD 等起動できない。

早速、Googleで調べてみると・・・ありました。

TeamViewer5 で Port 80 を起動しない方法

レジストリエディタ regedit で

HKEY_LOCAL_MACHINE\SOFTWARE\TeamViewer\Version5
GatewayAllowed
 と ListenHttp
DWORD値 1 → 0
2つの項目のDWORD値を 1 から 0 に変更すればよい。

TeamViewer5の起動後、AN_HTTPDを起動してみるとOK、勿論WAMP環境でもOKでした。

phpMyAdminをインストール時「PHP 5.2+ is required」エラー

phpMyAdminをインストールしたところ

PHP 5.2+ is required
というエラーが出たので対策方法を書いておきます。
2010.7.5現在phpのバージョンが5.1.*のようで最新のphpMyAdminに対応していなかったみたいです。

5.1に対応したバージョンを落としてインストールします。

ダウンロード先

ここからphpMyAdmin-2.11.10-all-languages.tar.gzをダウンロードしてきます。
#tar xzvf phpMyAdmin-2.11.10-all-languages.tar.gz
#mv phpMyAdmin-2.11.10-all-languages /var/www/phpmyadmin
以降はCentOSで自宅サーバーのとおりインストールします。
さあ、OKかと思ったところ下記のエラーが見える
mcrypt 拡張をロードできません。PHP の設定を確認してください。
こんな時は
#yum install php-mcrypt
でインストールします。

2010年7月3日土曜日

ffmpeg エラー ”lame: output buffer too small”

現象
ffmpegでビデオファイルを変換中に下記のようなエラーが出て、変換が途中で止まってしまう。

lame: output buffer too small
CentOS 5 の lame 3.98-2 にはバグがあるらしい。

対策
lame最新版のソースから rpm を作る。

ソースパッケージのダウンロード

# cd /usr/src/redhat/SRPMS
# wget http://apt.sw.be/redhat/el5/en/SRPMS.rpmforge/lame-3.98.2-1.rf.src.rpm
ソースパッケージの展開
# rpm -ivh lame-3.98.2-1.rf.src.rpm
最新のソースtar ballをダウンロード
# cd ../SOURCES
# wget http://downloads.sourceforge.net/project/lame/lame/3.98.4/lame-3.98.4.tar.gz?use_mirror=jaist
SPECファイルの変更
# cd ../SPECS
# mv lame.spec lame.spec.org
# wget http://wiki.open-art.jp/files/lame.spec
リビルドでの依存パッケージのインストール
# yum install nasm ncurses-devel
Installed:
nasm.i386 0:0.98.39-3.2.2
ncurses-devel.i386 0:5.5-24.20060715
SPECファイルを元にリビルド
# rpmbuild -bb lame.spec
------------------------------------------------------
+ cd /usr/src/redhat/BUILD
+ cd lame-3.98.4
+ /bin/rm -rf /var/tmp/lame-3.98.4-1.rf-root
+ exit 0
バイナリパッケージのインストール
# cd ../RPMS/i386
# yum localinstall --nogpgcheck lame-3.98.4-1.rf.i386.rpm lame-devel-3.98.4-1.rf.i386.rpm
Running Transaction
Updating : lame 1/4
Updating : lame-devel 2/4
Cleanup : lame-devel 3/4
Cleanup : lame 4/4
Updated:
lame.i386 0:3.98.4-1.rf lame-devel.i386 0:3.98.4-1.rf
検証
途中でエラーが出たaviファイルを変換したところ無事にエンコ出来た。

ffmpeg-phpのインストール

動画データの管理をしやすくするために ffmpeg-php の導入を試みた。

ffmpeg-phpのインストール

$ wget http://downloads.sourceforge.net/ffmpeg-php/ffmpeg-php-0.6.0.tbz2

$ tar jxvf ffmpeg-php-0.6.0.tbz2
$ cd ffmpeg-php-0.6.0
$ phpize
$ ./configure && make && make install
$ vi /etc/php.d/ffmpeg.ini
extension=ffmpeg.so #追加
$ /etc/init.d/httpd reload

$ cd
$ rm -rf ffmpeg-php-0.6.0.tbz2.2 ffmpeg-php-0.6.0
動作確認
解凍したディレクトリにtest_ffmpeg.phpというファイルとtestsというディレクトリがあるので、これを公開しているディレクトリにコピーしてtest_ffmpeg.phpを実行する
tests/mediaにある動画と音声ファイルの情報を出力します。
インストールされているバージョンを確認する場合もこのファイルを参考に出来ます。

Errors対策
・makeで”ffmpeg headers not found”エラーが出現
configure: error: ffmpeg headers not found. Make sure ffmpeg is compiled as shared libraries using the --enable-shared option
 ffmpeg-develがインストールされていないためライブラリーが読み込まれていないみたい。
$ yum --enablerepo=rpmforge install ffmpeg-devel

2010年6月20日日曜日

CentOS Server on VMware Workstation でクローン作成

現在、hiyokoが公開しているサーバーは、VMware Workstation 上で CentOS5.4 を稼動・公開しています。

CentOS を導入しているHDDは、VMware の起動時にスナップショット作成するよう設定していましたがここに来て容量が厳しくなってきたため、大きいHDDにクローン移行を試みた。

A.クローンの概要

クローンは既存の仮想マシンのコピーです。その既存の仮想マシンは、クローンの親になります。クローン処理が完了すると、クローンは独立した仮想マシンとなります。

  • クローンに行った変更は、親仮想マシンに影響を与えません。親仮想マシンに行った変更も、クローンには表示されません。
  • クローンのMACアドレスとUUID は、親仮想マシンのものとは別になります。
仮想マシンの現在の状態を保存してその状態を復元できるようにするには、スナップショットを作成します。仮想マシンのコピーを作成して個別に使用する場合は、クローンを作成します。
クローンは独立した仮想マシンですが、リンククローンの場合には仮想ディスクを親仮想マシンと共有します。

今回の目的では、リンククローンではなく、クローンを行う必要がありそうです。
また
MACアドレスが別のものになるということは、現在稼動中の CentOS は、固定アドレスを割り当てていますが、これが違うものになるということですね。したがってクローンが出来上がったら、CentOS上のコンソールでネットワークの設定をいじる必要があるということです。

B.手順

1.クローンの作成(VMware Workstation上にて)
  • VMware Workstation を起動しクローンする仮想マシンを読み込みます。
  • クローンする仮想マシンのタブを選択
  • メニュー
  • VM(M)
  • クローン作成(O)
  • ウイザード 次へ(N)
  • 「仮想マシンの現在の状態」にチェック 次へ(N)
  • 「完全クローンの作成(F)」にチェック 次へ(N)
  • 「仮想マシン名(V)」に名前を入力 「格納場所(L)」を設定し 完了
  • しばし待つ

    事前に割り当てたハードディスクは、事前に割り当てないディスクに変更されていました。
    大きくHDDを割り当てていたため、この結果には助かりました。1.2TB→300GB
2.CentOS上にて

CentOSは固定アドレスで運用しているため、netデバイスを書き換えます。
  • # system-network-config コマンドで固定アドレスの設定
  • # /etc/rc.d/init.d/network restart ネットワークを再読み込み
  • # ifconfig コマンドで確認
以上

2010年3月11日木曜日

RFC違反のメールアドレス

hiyokoが管理しているサーバーでは、幾つかのメール配信(MailmanやCGI)を行っています。

そんな中、携帯電話から登録する方が多くなっているのが現状ですが、相変わらず変なメールアドレスが見受けられ、配信不能になっている。

このことは、ユーザーの問題ではないと思います、各社携帯キャリアがしっかり管理しないと・・・
余計な時間がとられて困ります。勿論ユーザーの方も何がなんだか分からないでしょうから。

もっとシッカリせい!独自規格などイランワイ!


今後のために
参考になるサイトからおもいっきり引用
http://m97087yh.seesaa.net/article/123135487.html

メールアドレスに使用できる文字列は基本的にRFC2822で規定されている。

http://srgia.com/docs/rfc2822j.html

具体的には、

・大文字小文字のアルファベット

・数字

・! (エクスクラメーション)
・# (シャープ)
・$ (ダラー)
・% (パーセント)
・& (アンパサンド)
・' (シングルクォーテーション)
・* (アステリスク)
・+ (プラス)
・- (ハイフン、マイナス)
・/ (スラッシュ)
・= (イコール)
・? (クエスチョン)
・^ (キャロット、ハットマーク)
・` (バッククオート)
・{ } (中括弧開く閉じる)
・| (パイプライン)
・~ (チルダ)
・. (ドット、ピリオド)
・_ (アンダースコア、アンダーバー)

上記以外の文字の使用は不可。
"."(ドット)の使用は可能だが、連続しての使用は不可。
また、ローカル部(@の左側)の始めや終わりにも使用不可。

という決まりがある。

最近は、各携帯電話会社も準拠するようになっているが、

少し前まで、一部のプロバイダや、携帯電話会社ではこの仕様に準拠していなかった。
赤色の”.”ドットの取り扱いに問題がある方が多いですね。

2010年1月26日火曜日

キャッシュ及びアクセラレーターの比較

ベンチマークの比較です。
1.Apacheのキャッシュ機能を有効にした場合
2.PHPアクセラレーター(Xcache)を使った場合
3.XOOPSのキャッシュ機能を有効にした場合

サーバーを設置した場所とは全く別のサイトにCentOS環境を作成し、下記コマンドで比較した

[root@localhost ~]# ab -n 100 -c 10 http://xxxx-net.jp/
比較表
               Normal    Apache Cache On   PHP Xcache On
Time taken for tests:
1回目           28.921658     21.236325       12.785964
2回目           22.197865     24.28028       10.592108
3回目           29.399440     21.620780
Requests per second:
1回目           3.46         4.71           7.82
2回目           4.50         4.16           9.44
3回目           3.44         4.63

確かに速くなってます。
Xcacheでは体感上も確実に速度アップしました。
XOOPSのキャッシュ機能での比較はでは殆んど変化しなかったためここには載せていません。
設定が悪いのだろうか?

2010年1月25日月曜日

Xcacheを設定した場合のベンチマーク

1回目

[root@localhost ~]# ab -n 100 -c 10 http://xxxx-net.jp/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

benchmarking xxxx-net.jp (be patient).....done

Server Software: Apache
Server Hostname: xxxx-net.jp
Server Port: 80
Document Path: /
Document Length: 0 bytes
Concurrency Level: 10
Time taken for tests: 12.785964 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Total transferred: 36400 bytes
HTML transferred: 0 bytes
Requests per second: 7.82 [#/sec] (mean)
Time per request: 1278.596 [ms] (mean)
Time per request: 127.860 [ms] (mean, across all concurrent requests)
Transfer rate: 2.74 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 51 360 899.9 64 3050
Processing: 403 817 411.1 757 4253
Waiting: 402 807 404.0 753 4252
Total: 467 1177 1042.7 812 4318
Percentage of the requests served within a certain time (ms)
50% 812
66% 857
75% 878
80% 915
90% 4029
95% 4050
98% 4068
99% 4318
100% 4318 (longest request)
2回目
[root@localhost ~]# ab -n 100 -c 10 http://xxxx-net.jp/

This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking xxxx-net.jp (be patient).....done

Server Software: Apache
Server Hostname: xxxx-net.jp
Server Port: 80

Document Path: /
Document Length: 0 bytes

Concurrency Level: 10
Time taken for tests: 10.592108 seconds
Complete requests: 100
Failed requests: 0
Write errors: 0
Total transferred: 36400 bytes
HTML transferred: 0 bytes
Requests per second: 9.44 [#/sec] (mean)
Time per request: 1059.211 [ms] (mean)
Time per request: 105.921 [ms] (mean, across all concurrent requests)
Transfer rate: 3.30 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 53 92 283.0 63 2893
Processing: 439 843 1152.4 626 8477
Waiting: 438 835 1151.4 626 8477
Total: 505 936 1177.1 691 8542

Percentage of the requests served within a certain time (ms)
50% 691
66% 723
75% 757
80% 805
90% 1043
95% 1437
98% 8442
99% 8542
100% 8542 (longest request)
約二倍ほど速くなったかな??

PHP アクセラレーターXcacheのインストール

早速インストール

[root@centos ~]# cd /usr/local/src
[root@centos src]# wget http://xcache.lighttpd.net/pub/Releases/1.3.0/xcache-1.3.0.tar.gz
[root@centos src]# tar xzvf xcache-1.3.0.tar.gz
[root@centos src]# cd xcache-1.3.0
[root@centos xcache-1.3.0]# phpize
[root@centos xcache-1.3.0]# ./configure --enable-xcache
[root@centos xcache-1.3.0]# make/usr/include/php/ext/date/lib/timelib_structs.h:24:28: error: timelib_config.h: No such file or directory/usr/local/src/xcache-1.3.0/xcache.c:2959: warning: initialization discards qualifiers from pointer target type
make: *** [xcache.lo] エラー 1

失敗!
googleで検索
Posted by moo XCache
on 15.08.2009 02:52
not a XCache problem. looks like it have problem searching .h file witin the same directory which compiler are u using? i assume it's gcc... hrm... open /usr/include/php/ext/date/lib/timelib_structs.h change #include <timelib_config.h> to #include "timelib_config.h" (or vice versa) or #include "/usr/include/php/ext/date/lib/timelib_config.h"
とあるので、timelib_structs.h を編集、保存
再度
[root@centos xcache-1.3.0]# make
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
Build complete.
(It is safe to ignore warnings about tempnam and tmpnam).
[root@centos xcache-1.3.0]# make install
Installing shared extensions:     /usr/lib/php/modules/
成功!
次に設定ファイルの配置xcache.iniの内容を上記インストールディレクトリーに書き換え、パスワードを設定し保存、コピー
まず最初にコマンドラインからxcache.admin.passの値を求めてメモしておく。(******は各自適当に)
[root@centos xcache-1.3.0]# echo -n '******' | md5sum ←これをUser欄に挿入
XXXXXXXXXX ←これをパスワード欄に挿入
[xcache-common]
;; install as zend extension (recommended), normally "$extension_dir/xcache.so"
;zend_extension = /usr/local/lib/php/extensions/non-debug-non-zts-xxx/xcache.so
zend_extension = /usr/lib/php/modules/xcache.so
; zend_extension_ts = /usr/local/lib/php/extensions/non-debug-zts-xxx/xcache.so
;; For windows users, replace xcache.so with php_xcache.dll
;zend_extension_ts = c:/php/extensions/php_xcache.dll
;; or install as extension, make sure your extension_dir setting is correct
; extension = xcache.so
;; or win32:
; extension = php_xcache.dll

[xcache.admin]
xcache.admin.enable_auth = On
xcache.admin.user = "*******"
; xcache.admin.pass = md5($your_password)
xcache.admin.pass = "XXXXXXXXXXX"
[root@centos xcache-1.3.0]# cp xcache.ini /etc/php.d/
Webサーバーの再起動とXcacheの起動確認
[root@centos xcache-1.3.0]# /etc/rc.d/init.d/httpd restart
httpd を停止中: [ OK ]
httpd を起動中: [ OK ]
[root@centos xcache-1.3.0]# php -v
PHP 5.1.6 (cli) (built: Jan 13 2010 17:13:05)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
with XCache v1.3.0, Copyright (c) 2005-2009, by mOo
はいOK!
続いて、ブラウザ管理の設定
adminディレクトリー内のファイルを/var/www/xcacheへコピー
[root@centos xcache-1.3.0]# mkdir /var/www/xcache
[root@centos xcache-1.3.0]# cd admin
[root@centos xcache-1.3.0]# cp * /var/www/xcache/
/var/www/xcache/をブラウザから見れるように設定する。適当にxcache.confファイルを作成し放り込む
で!設定ファイルが見れるようになりましたとさ・・・
後は後日!

2010年1月20日水曜日

1.Apacheのキャッシュ機能を有効にした場合

設定は、ここを参照

1回目

[root@localhost ~]# ab -n 100 -c 10 http://xxxx-net.jp/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking xxxx-net.jp (be patient).....done

Server Software:        Apache
Server Hostname:        xxxx-net.jp
Server Port:            80

Document Path:          /
Document Length:        0 bytes

Concurrency Level:      10
Time taken for tests:   21.236325 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      36400 bytes
HTML transferred:       0 bytes
Requests per second:    4.71 [#/sec] (mean)
Time per request:       2123.632 [ms] (mean)
Time per request:       212.363 [ms] (mean, across all concurrent requests)
Transfer rate:          1.65 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       53  502 1466.4     66    8965
Processing:   294 1590 1904.3   1167   11519
Waiting:      290 1589 1903.3   1167   11518
Total:        398 2093 2385.1   1302   11602

Percentage of the requests served within a certain time (ms)
  50%   1302
  66%   1399
  75%   1762
  80%   2037
  90%   4711
  95%   9868
  98%  10700
  99%  11602
 100%  11602 (longest request)
2回目
[root@localhost ~]# ab -n 100 -c 10 http://xxxx-net.jp/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking xxxx-net.jp (be patient).....done

Server Software:        Apache
Server Hostname:        xxxx-net.jp
Server Port:            80

Document Path:          /
Document Length:        0 bytes

Concurrency Level:      10
Time taken for tests:   24.28028 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      36400 bytes
HTML transferred:       0 bytes
Requests per second:    4.16 [#/sec] (mean)
Time per request:       2402.803 [ms] (mean)
Time per request:       240.280 [ms] (mean, across all concurrent requests)
Transfer rate:          1.46 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       52  539 1089.9     68    3076
Processing:   285 1720 3026.7    919   15435
Waiting:      285 1718 3026.6    919   15434
Total:        342 2259 3539.5   1159   18424

Percentage of the requests served within a certain time (ms)
  50%   1159
  66%   1520
  75%   1882
  80%   3379
  90%   4179
  95%  14152
  98%  18274
  99%  18424
 100%  18424 (longest request)
3回目
[root@localhost ~]# ab -n 100 -c 10 http://xxxx-net.jp/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking xxxx-net.jp (be patient).....done

Server Software:        Apache
Server Hostname:        xxxx-net.jp
Server Port:            80

Document Path:          /
Document Length:        0 bytes

Concurrency Level:      10
Time taken for tests:   21.620780 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      36400 bytes
HTML transferred:       0 bytes
Requests per second:    4.63 [#/sec] (mean)
Time per request:       2162.078 [ms] (mean)
Time per request:       216.208 [ms] (mean, across all concurrent requests)
Transfer rate:          1.62 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       51  776 1939.9     64    9003
Processing:   287 1269 1013.0   1029    5055
Waiting:      284 1268 1013.1   1029    5055
Total:        341 2046 2229.2   1241   10864

Percentage of the requests served within a certain time (ms)
  50%   1241
  66%   1650
  75%   3247
  80%   3409
  90%   4477
  95%   5722
  98%  10700
  99%  10864
 100%  10864 (longest request)

若干速くなったかな?のレベル!

abコマンドによるApacheサーバーの測定

Apacheサーバーの読み込み速度の向上を目指す。

まずは測定から
1回目

[root@localhost ~]# ab -n 100 -c 10 http://xxxx-net.jp/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking xxxx-net.jp (be patient).....done


Server Software:        Apache
Server Hostname:        xxxx-net.jp
Server Port:            80

Document Path:          /
Document Length:        37584 bytes

Concurrency Level:      10
Time taken for tests:   28.921658 seconds
Complete requests:      100

Failed requests: 79   (Connect: 0, Length: 79, Exceptions: 0)
Write errors:           0
Total transferred:      826546 bytes
HTML transferred:       789264 bytes
Requests per second:    3.46 [#/sec] (mean)
Time per request:       2892.166 [ms] (mean)
Time per request:       289.217 [ms] (mean, across all concurrent requests)
Transfer rate:          27.90 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       51  887 2012.3     64    7519
Processing:   290 1933 2688.8   1083   15819
Waiting:      289 1864 2673.5   1063   15819
Total:        393 2821 3243.5   1224   15896

Percentage of the requests served within a certain time (ms)
  50%   1224
  66%   2863
  75%   3277
  80%   3749
  90%   7847
  95%  10987
  98%  15701
  99%  15896
 100%  15896 (longest request)
「Failed requests: 79」なんでだろう?

2回目
[root@localhost ~]# ab -n 100 -c 10 http://xxxx-net.jp/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking tachibana-net.jp (be patient).....done


Server Software:        Apache
Server Hostname:        xxxx-net.jp
Server Port:            80

Document Path:          /
Document Length:        0 bytes

Concurrency Level:      10
Time taken for tests:   22.197865 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      36400 bytes
HTML transferred:       0 bytes
Requests per second:    4.50 [#/sec] (mean)
Time per request:       2219.786 [ms] (mean)
Time per request:       221.979 [ms] (mean, across all concurrent requests)
Transfer rate:          1.58 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       52  513 1073.0     64    3177
Processing:   285 1652 2012.3    989   13347
Waiting:      285 1651 2012.3    989   13346
Total:        339 2165 2563.8   1283   16357

Percentage of the requests served within a certain time (ms)
  50%   1283
  66%   1750
  75%   2931
  80%   3542
  90%   4922
  95%   7382
  98%  11485
  99%  16357
 100%  16357 (longest request)

3回目
[root@localhost ~]# ab -n 100 -c 10 http://xxxx-net.jp/
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking tachibana-net.jp (be patient).....done


Server Software:        Apache
Server Hostname:        xxxx-net.jp
Server Port:            80

Document Path:          /
Document Length:        0 bytes

Concurrency Level:      10
Time taken for tests:   29.39944 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      36400 bytes
HTML transferred:       0 bytes
Requests per second:    3.44 [#/sec] (mean)
Time per request:       2903.994 [ms] (mean)
Time per request:       290.399 [ms] (mean, across all concurrent requests)
Transfer rate:          1.21 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       52  954 2424.7     65    9165
Processing:   288 1633 2457.4    965   13319
Waiting:      288 1632 2457.3    963   13318
Total:        341 2587 3746.6   1221   21347

Percentage of the requests served within a certain time (ms)
  50%   1221
  66%   1653
  75%   2385
  80%   2710
  90%   8585
  95%  10120
  98%  20832
  99%  21347
 100%  21347 (longest request)


次回から
1.Apacheのキャッシュ機能を有効にした場合
2.PHPのアクセラレーターを使った場合
3.Xoopsモジュールのキャッシュを使用した場合

を調べてみることにします。どうなることやら・・・

2010年1月18日月曜日

Apache Server カスタマイズ??

Apacheのカスタマイズについて記事を拾ってみた。
そのうち時間ができたら検証してみることに・・・

まずは参照サイトを記述

GIGAZINE

ここを参照に随時トライしてみようと思う・・・

1.BufferedLogs ディレクティブの変更
参考
apacheのコンフィグファイルにBufferedLogsディレクティブをonにする

BufferedLogs on
後は、ab(apache bench)で検証しよう。

2.mod_mem_cacheの有効化
参考1  参考2
テストした環境はDSO環境なのでApacheへのモジュール有効化はLoadModuleで行うこと。
気をつける点はmod_mem_cacheは mod_cacheのサポートモジュールとして動作するので、
モジュールを有効にする場合はmod_cacheとセットで扱うこと。
<ifmodule mod_mem_cache.c="">
CacheEnable mem /
MCacheSize 262144
MCacheMaxObjectCount 100000
MCacheMinObjectSize 1
MCacheMaxObjectSize 131072
</IfModule>

2010年1月13日水曜日

ulogd「IPTables log analyzer」のインストール

CentOSで自宅サーバー構築を参考にサイトを構築しているが、

40.2.iptablesログ解析(IPTables log analyzer)

■ulogdインストール
 ここで問題発生

[root@centos /] # ./configure --prefix=/usr --sysconfdir=/etc --libdir=/usr/local/lib --with-mysql
[root@centos /] # make
ulogd_MYSQL.c:174: 警告: format '%lld' expects type 'long long int', but argument 3 has type 'int64_t' ulogd_MYSQL.c:206: 警告: format '%llu' expects type 'long long unsigned int', but argument 3 has type 'u_int64_t'
ld -shared -rdynamic -L/usr/lib64/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -lssl -lcrypto -o ulogd_MYSQL.so ulogd_MYSQL_sh.o -lc
ld: bad -rpath option
make[1]: *** [ulogd_MYSQL.so] エラー 1
make[1]: ディレクトリ `/root/work/ulogd/ulogd-1.24/mysql' から出ます
make: *** [recurse] エラー 1

Makeがうまくいかないみたい!いろいろなサイトを見てみると、どうも -rdynamic がいけないみたい。 で
Rules.make を編集(-rdynamic オプションを削除)
# mysql output support
#ULOGD_SL+=MYSQL
MYSQL_CFLAGS=-I-I/usr/include/mysql -DOLD_MYSQL=1
#MYSQL_LDFLAGS= -rdynamic -L/usr/lib64/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -lssl -lcrypto
MYSQL_LDFLAGS= -L/usr/lib64/mysql -lmysqlclient -lz -lcrypt -lnsl -lm -lssl -lcrypto
再度
[root@centos /] # make
[root@centos /] # make install

今度は成功!良し良し

2010年1月4日月曜日

VMware Workstation7 で USB2 の有効化

vmx ファイルに以下の行を追加

usb.present = "TRUE" # USB を利用
ehci.present = "TRUE" # EHCI コントローラを有効化
これで有効化できました。

リダイレクトの仕方

サーバーのログを見ていると、以前のトップファイル(あえてtop.phpとしていた)にアクセスする人がかなり多い。
もしかしたら、ページが表示されなくて未だに閉鎖中と思う方も多いと思ったので、リダイレクトしホームページを見ていただくようにした。

ネットで調べてみると幾つかの方法があるようです。
おもなリダイレクトの方法のなかから三つを試してみた。

  1. 301リダイレクトと呼ばれる方法で、.httaccessを使うなどして行うもの。
  2. HTML<meta http-equiv="Refresh" ...>を使う方法
  3. JavaScriptのlocation.href、またはlocation.replace()を使う方法
1.301リダイレクト
サーバー側に.htaccessを設置する方法。具体的なコードは以下。
Redirect permanent /top.php http://hogehoge.jp/index.php
Redirect permanent /top.html http://hogehoge.jp/index.php

top.phpにアクセスした場合に、index.phpにリダイレクトする
top.htmlにアクセスした場合に、index.phpにリダイレクトする

2.HTMLファイルのヘッダーに直接書き込む方法
head要素内に下記のようなコードを書けば良いだけです。簡単。しかし・・・
<meta http-equiv="Refresh" content="0; URL=/index.php">
/index.php に0秒後にリダイレクトする
*古いURLにリダイレクト用のHTMLを残しておかねばならない。

3.JavaScriptを使ってリダイレクトする
しかしlocation.hrefを使うと"「戻る」ボタンで戻れない問題"が発生するので、履歴の残らないlocation.replace()の方がいいかも(こちらでは戻れる)。
この手法も古いURLにリダイレクト用のHTMLファイルを置いておかねばならないという点で、1.に劣る。

したがって、今回は1.301リダイレクトの手法を選択した。

2009年12月27日日曜日

CentOS 5.4 に FFmpegをインストール(yum)

RPMforgeにffmpegが出ています。

# yum --enablerepo=rpmforge install ffmpeg

これまでソースからコンパイルしてた苦労は一体なんだったのかと思えるくらい簡単にインストールできました。

WebPhotoを十二分に使うためには必須なツールですので助かりました。
あと xpdf もどうにかならないものか・・・

2010/07/03[追記]
yumの「-」を「--」に変更