ラベル Linux の投稿を表示しています。 すべての投稿を表示
ラベル Linux の投稿を表示しています。 すべての投稿を表示

2012年10月18日木曜日

postfixをgmailにリレーする設定

psotfixをgmailにリレーする設定はいろいろな場所で説明されていますが、僕は少しだけ詰まったのでメモしときます


すべてのメールをgmailにリレーしなければならないので、mydestinationは設定しない


/etc/postifx/main.cfには下記を記述する(コピペでおk

relayhost = [smtp.gmail.com]:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_tls_security_options = noanonymous
smtp_sasl_mechanism_filter = plain
smtp_tls_CApath = /etc/pki/tls/certs/ca-bundle.crt


/etc/postfix/sasl_passwd にリレー先の認証情報を記述する

[smtp.gmail.com]:587 UserName@gmail.com:PassWord


ここまではどこにでも書いてあるのですが、
僕はCentOS6を最小限インストール(minimal install)したのでパッケージが足りませんでした、
そこでcyrus-sasl-*をインストールしました

yum install cyrus-sasl-*


それとmailコマンドが入ってないのでmailxパッケージをインストールしました

yum install mailx


これでmailコマンドが利用できるようになります

2012年4月30日月曜日

PHP でのエラーとか

Webからphpにアクセスしても真っ白(何も表示されない)な時は
コンソールから
$php -l {ファイルのパス}
とし シンタックスエラーが無いか確認する
PHP Parse error: syntax error, unexpected '*' in ./Filename.php on line Num
と表示された場合 ./filename.phpNum行目付近でパースできないと行ってるので
その行を確認する

No syntax errors detected in ./filename.php
と表示されればシンタックスエラーは無い
それでも表示されない場合は

$php -a ./{ファイル名}
として実際に実行してみる

そして今回は
PHP Fatal error: Allowed memory size of 838860800 bytes exhausted (tried to allocate 983040 bytes) in /var/www/video/public_html/includes/classes/lang.class.php on line 192
と表示されたので
/etc/php.iniの
memory_limitの量を大きくしhttpdをリロードする
service httpd reload
Reloading httpd: [ OK ]

2012年1月7日土曜日

OpenSSHでECDSA unknow key typeエラーが出る場合の対処法

OpenSSH 5.7からECDSA(楕円曲線暗号)がサポート[*]されるようになりました
だがしかし!
sshd起動するとECDSAのホストキーが無いよ!的なエラーメッセージが表示される!
Ω ΩΩ<な、なんだってー
(なかったら自動で生成するんじゃないの?)
と思いつつ
ssh-keygen でECDSAキーを生成しようとしても
[root@blog.m264.com ~]$ ssh-keygen -t ecdsa -N '' -f /etc/ssh/ssh_host_ecdsa_key
ssh-keygen: generating new host keys: ECDSA unknown key type (null)
と表示されて 生成できないんです


最初はOpenSSH側の問題だと思って調べてたんですが エラーメッセージちゃんと読むとECDSAとか知らないから作れねーよ BOKEって言ってたので
じゃぁssh_host_ecdsa_key作ればいんじゃね?って事で
[root@blog.m264.com ~]$ touch /etc/ssh/ssh_host_ecdsa_key

ってやったら普通にエラーメッセージ吐かずに動いてくれました、メデタシメデタシ。
(根本的な解決にはなってない気がするw


2010年11月23日火曜日

Fedora14 にVMware Server 2.0をインストールする

FedoraさんにVMware Serverをインストールしようとして躓いたので、メモしますw
(たぶんUbuntuとかCentOSとかでも同じ方法でいけると思うのでもし普通にインストールできなかったら下記の方法も試してみて下さい)

VMware Serverをダウンロードしインストールします
Firefox等でvmwareにアクセスし=>Product=>WMware serverをクリックしVMware Server 2 for Linux Operating Systems(gz)をダウンロードします。
(vmwareへの登録が必要となります)

次にこのファイルをダウンロードし解凍しますます
[root@blog.m264.com ~]$wget http://short.m264.info/95QAX6
--2010-11-22 14:49:08-- http://short.m264.info/95QAX6
Resolving download.github.com... 207.97.227.240
Connecting to download.github.com|207.97.227.240|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8696 (8.5K) [application/octet-stream]
Saving to: “raducotescu-vmware-server-linux-2.6.3x-kernel-release-1.5-1-g71f8b66.tar.gz”

100%[====================================================>] 8,696 20.0K/s in 0.4s

2010-11-22 14:49:10 (20.0 KB/s) - “raducotescu-vmware-server-linux-2.6.3x-kernel-release-1.5-1-g71f8b66.tar.gz” saved [8696/8696]
[root@blog.m264.com ~]$tar -xvf ./raducotescu-vmware-server-linux-2.6.3x-kernel-release-1.5-1-g71f8b66.tar.gz
raducotescu-vmware-server-linux-2.6.3x-kernel-71f8b66/
raducotescu-vmware-server-linux-2.6.3x-kernel-71f8b66/LICENSE
raducotescu-vmware-server-linux-2.6.3x-kernel-71f8b66/README
raducotescu-vmware-server-linux-2.6.3x-kernel-71f8b66/start-VMware-console.sh
raducotescu-vmware-server-linux-2.6.3x-kernel-71f8b66/vmware-config.patch
raducotescu-vmware-server-linux-2.6.3x-kernel-71f8b66/vmware-server-2.0.2-203138-update.patch
raducotescu-vmware-server-linux-2.6.3x-kernel-71f8b66/vmware-server-2.0.x-kernel-2.6.3x-install.sh

次に先ほど解凍したraducotescu-vmware-server-linux-2.6.3x-kernel-71f8b66の中にあるvmware-server-2.0.x-kernel-2.6.3x-install.shを実行します
[root@blog.m264.com ~]$sh ./raducotescu-vmware-server-linux-2.6.3x-kernel-71f8b66/vmware-server-2.0.x-kernel-2.6.3x-install.sh ./
途中で
Please enter your 20-character serial number.
Type XXXXX-XXXXX-XXXXX-XXXXX or 'Enter' to cancel:
って言われるのでVMware serverをダウンロードしたページに書いてあるLinux用のシリアルナンバを入力します

最後にさらに何回か質問されるので、エンターを押して下さい。
Enjoy,

--the VMware team
と表示されればインストールは完了です。
直後に
Starting VMware services:
Virtual machine monitor [ OK ]
Virtual machine communication interface [ OK ]
Virtual ethernet [ OK ]
Bridged networking on /dev/vmnet0 [ OK ]
Host-only networking on /dev/vmnet8 (background) [ OK ]
DHCP server on /dev/vmnet8 [ OK ]
NAT service on /dev/vmnet8 [ OK ]
VMware Server Authentication Daemon (background) [ OK ]
Shared Memory Available [ OK ]
Starting VMware management services:
VMware Server Host Agent (background) [ OK ]
VMware Virtual Infrastructure Web Access
Starting VMware autostart virtual machines:
と表示され VMware serverが利用できるようになるはずです
ついでに管理用のページはインストール課程で特に設定してなければIP_ADDR:8333になってるはずです

2010年11月6日土曜日

Fedora14で無線LANを使う

先日リリースされたばかりのFedora14ですが
USB無線LANクライアントであるWLI-UC-G300HPを利用するための情報が無かったので、、、
(間違ってる場所があったらコメント等で指摘してもらえればと思います><

有線にてネットワークにつながっている物とします
(有線できない場合は別PCなどからUSBメモリー等に予めダウンロードしておいて下さい)

必要なパッケージをインストールします
[root@blog.m264.com ~]$ yum install kernel-headers gcc

WLI-UC-G300HPをUSB端子に差し込み認識しているか確認します
[root@blog.m264.com ~]$ lsusb | grep "WLI-UC-G300HP"
を実行します
Bus 004 Device 002: ID 0411:0148 MelCo., Inc. Buffalo WLI-UC-G300HP Wireless LAN Adapter
と表示されれば認識しています
このとき太文字部分の数字を覚えておいてください

http://www.ralinktech.com/support.php?s=2
にアクセスしRT2870USB(RT2870/RT2770)をダウンロードしてください
(現時点の最新版は2.4.0.1です)

次にダウンロードしたファイルを解凍します
[root@blog.m264.com ~]$ tar -xvf 2010_0709_RT2870_Linux_STA_v2.4.0.1.tar.bz2
移動します
[root@blog.m264.com ~]$ cd ./2010_0709_RT2870_Linux_STA_v2.4.0.1
必要なファイルを変更します
[root@blog.m264.com ~]$ vim ./os/linux/config.mk
# Support ATE function
HAS_ATE=n

# Support QA ATE function
HAS_QA_SUPPORT=n

# Support XLINK mode
HAS_XLINK=n

# Support Wpa_Supplicant
HAS_WPA_SUPPLICANT=y

# Support Native WpaSupplicant for Network Maganger
HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y

#Support Net interface block while Tx-Sw queue full
HAS_BLOCK_NET_IF=n

#Support DFS function
HAS_DFS_SUPPORT=n
上記の太字の部分をnからyに変更します

[root@blog.m264.com ~]$ vim ./common/rtusb_dev_id.c
        {USB_DEVICE(0x0DB0,0x6899)},
        {USB_DEVICE(0x0DB0,0x6899)},
        {USB_DEVICE(0x0411,0x0148)},
#endif // RT2870 //
        { }/* Terminating entry */
};
太文字部分を追加します 赤文字部分はlsusbを行った際に表示されていた英数字を入力します
wget -qO- http://short.m264.info/9opAEv | patch -ul -p0
を実行します
後はビルドするだけです
make
sudo make install
コレで上手く行くはずです

後は再起動してNetworkManagerで設定をすればつながるはずです

2010年11月4日木曜日

Fedora13からFedora14にアップグレード

Fedora13からFedora14にアップグレードするには
preupgradeを利用する
コンソールから
preupgrade
を実行した後にrootパスワードを入力しウィザードにそって進めていくと必要なパッケージをダウンロードしてくれる
それが終わると自動でキックスタートファイルを生成しGRUBにアップグレード用の設定が追加され再起動が要求される

再起動を押下すると後は自動でパッケージのインストールが行われFedora14の環境が利用可能になるはずです

2010年10月6日水曜日

CentOSにvim7.3をインストールする

CentOSの標準リポジトリーにあるのは旧バージョンのvimなので
最新のvim7.3をインストールします
まず既存のvimをアンインストールし必要なパッケージを追加します
[root@blog.m264.com ~]$ yum -y remove vim-enhaced vim-common
[root@blog.m264.com ~]$ yum -y install ncurses-devel patch gcc

次に必要なファイルをダウンロードします
[root@blog.m264.com ~]$ wget http://short.m264.info/vim730
--2010-10-06 00:35:16--  
Resolving short.m264.info... 168.143.174.97
Connecting to short.m264.info|168.143.174.97|:80... connected.
HTTP request sent, awaiting response... 301 Moved
Location: http://ftp.vim.org/pub/vim/unix/vim-7.3.tar.bz2 [following]
--2010-10-06 00:35:16--  http://short.m264.info/vim730
Resolving ftp.vim.org... 192.87.102.42, 192.87.102.43, 2001:610:1:80aa:192:87:102:42, ...
Connecting to ftp.vim.org|192.87.102.42|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 9080692 (8.7M) [application/x-bzip2]
Saving to: `vim-7.3.tar.bz2'

100%[=========================================================>] 9,080,692    894K/s   in 15s

解凍してパッチフォルダを作ります
[root@blog.m264.com ~]$ tar -xvf ./vim-7.3.tar.bz2
[root@blog.m264.com ~]$ mkdir patches
[root@blog.m264.com ~]$ cd vim73/patches

パッチをダウンロードします
http://short.m264.info/ayQLCM からパッチの数を確認してください
(7.3.*** ←ココの数字が何番まであるか確認)

[root@blog.m264.com ~]$ seq -f http://ftp.vim.org/pub/vim/patches/7.3/7.3.%03g パッチの数 | xargs wget
--2010-10-06 00:28:21--  http://ftp.vim.org/pub/vim/patches/7.3/7.3.001
Resolving ftp.vim.org... 192.87.102.43, 192.87.102.42, 2001:610:1:80aa:192:87:102:42, ...
Connecting to ftp.vim.org|192.87.102.43|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1720 (1.7K) [text/plain]
Saving to: `7.3.001'

100%[=====================================================>] 1,720       --.-K/s   in 0.001s

2010-10-06 00:28:24 (2.06 MB/s) - `7.3.019' saved [2747/2747]

-----------
パッチの数だけダウンロードするのでパッチの数によっては時間がかかる
-----------

--2010-10-06 00:28:24--  http://ftp.vim.org/pub/vim/patches/7.3/7.3.019
Connecting to ftp.vim.org|192.87.102.43|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2987 (2.9K) [text/plain]
Saving to: `7.3.019'

100%[======================================================>] 2,987       --.-K/s   in 0.001s

パッチを当てる
[root@blog.m264.com ~]$ cat patches/7.3.* | patch -p0
patching file src/misc1.c
patching file src/version.c
patching file src/ex_docmd.c
patching file src/version.c
patching file src/quickfix.c
patching file src/version.c
patching file src/regexp.c
patching file src/version.c
patching file src/eval.c
patching file src/testdir/Makefile
patching file src/testdir/test61.in
patching file src/version.c
patching file src/mbyte.c
patching file src/spell.c
patching file src/version.c
patching file src/if_py_both.h
patching file src/version.c
patching file src/buffer.c
patching file src/diff.c
patching file src/ex_cmds.c
patching file src/ex_cmds2.c
patching file src/ex_docmd.c
patching file src/ex_getln.c
patching file src/if_cscope.c
patching file src/macros.h
patching file src/quickfix.c
patching file src/search.c
patching file src/tag.c
patching file src/window.c
patching file src/version.c
patching file src/os_win32.c
patching file src/version.c
patching file src/gui_mac.c
patching file src/version.c
patching file src/ui.c
patching file src/os_unix.c
patching file src/version.c
patching file src/Make_ming.mak
patching file src/GvimExt/Make_ming.mak
patching file src/version.c
patching file src/if_ruby.c
patching file src/version.c
patching file src/ex_getln.c
patching file src/version.c
patching file src/testdir/test49.vim
patching file src/version.c
patching file runtime/doc/netbeans.txt
patching file src/gui.c
patching file src/main.c
patching file src/netbeans.c
patching file src/version.c
patching file src/spell.c
patching file src/syntax.c
patching file src/version.c
patching file src/Make_ming.mak
patching file src/GvimExt/Make_ming.mak
patching file src/version.c
patching file src/netbeans.c
patching file src/version.c
configureする(オプションはお好みで)
[root@blog.m264.com ~]$ ./configure --prefix=/usr --enable-multibyte --with-features=huge --disable-selinux
configure: loading cache auto/config.cache
checking whether make sets $(MAKE)... no
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for library containing strerror... none required
以下略
makeしてインストール!
[root@blog.m264.com ~]$ make
mkdir objects
CC="gcc -Iproto -DHAVE_CONFIG_H         " srcdir=. sh ./osdef.sh
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/buffer.o buffer.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/blowfish.o blowfish.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/charset.o charset.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/diff.o diff.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/digraph.o digraph.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/edit.o edit.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/eval.o eval.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/ex_cmds.o ex_cmds.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/ex_cmds2.o ex_cmds2.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/ex_docmd.o ex_docmd.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/ex_eval.o ex_eval.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/ex_getln.o ex_getln.c
gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -D_FORTIFY_SOURCE=1       -o objects/fileio.o fileio.c
以下略
[root@blog.m264.com ~]$ make install
Starting make in the src directory.
If there are problems, cd to the src directory and run make there
cd src && make install
make[1]: Entering directory `/root/work/vim/vim73/src'
if test -f /usr/bin/vim; then \
          mv -f /usr/bin/vim /usr/bin/vim.rm; \
          rm -f /usr/bin/vim.rm; \
        fi
cp vim /usr/bin
strip /usr/bin/vim
chmod 755 /usr/bin/vim
/bin/sh ./mkinstalldirs /usr/share/vim
mkdir /usr/share/vim
chmod 755 /usr/share/vim
cp vimtutor /usr/bin/vimtutor
以下略
vimを起動する
vim

1
~
~                                   VIM - Vi IMproved
~
~                                     version 7.3.19
~                                by Bram Moolenaar et al.
~                      Vim is open source and freely distributable
~
~                             Help poor children in Uganda!
~                     type  :help iccf       for information
~
~                     type  :q               to exit
~                     type  :help  or    for on-line help
~                     type  :help version7   for version info
~

2010年10月1日金曜日

libxvidを入れる

yumにlibxvidが無かったのでソースファイルからインストールします
まずlibxvidをダウンロードします
[root@blog.m264.com ~]$ wget http://short.m264.info/xvidcore
--2010-09-30 18:36:51--  http://short.m264.info/xvidcore
downloads.xvid.org をDNSに問いあわせています... 88.198.32.206
downloads.xvid.org|88.198.32.206|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 643344 (628K) [application/x-bzip]
`xvidcore-1.2.2.tar.bz2' に保存中

100%[================================================>] 643,344      155K/s 時間 4.1s

2010-09-30 18:36:56 (155 KB/s) - `xvidcore-1.2.2.tar.bz2' へ保存完了 [643344/643344]
解凍してフォルダを移動します
[root@blog.m264.com ~]$ tar -xf xvidcore-1.2.2.tar.bz2
[root@blog.m264.com ~]$ cd ./xvidcore/build/generic
メイクしてインストールします
[root@blog.m264.com ~]$ ./configure
/root/work/xvidcore/build/generic
[root@localhost generic]# ./configure
checking build system type... i686-pc-linux
checking host system type... i686-pc-linux
checking target system type... i686-pc-linux
checking whether to use default CFLAGS... yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for a BSD-compatible install... /usr/bin/install -c
checking for ranlib... ranlib
checking for whether to use assembly code... yes
checking for architecture type... ia32
checking how to run the C preprocessor... gcc -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for int *... yes
checking size of int *... 4
checking whether byte ordering is bigendian... no
checking for build extensions... .so .a .o
checking for platform specific LDFLAGS/CFLAGS... ok
checking for yasm... no
checking for nasm... no
configure: WARNING: no correct assembler was found - Compiling generic sources only
checking stdio.h usability... yes
checking stdio.h presence... yes
checking for stdio.h... yes
checking signal.h usability... yes
checking signal.h presence... yes
checking for signal.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking assert.h usability... yes
checking assert.h presence... yes
checking for assert.h... yes
checking math.h usability... yes
checking math.h presence... yes
checking for math.h... yes
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking for pthread_create in -lpthread... yes
checking for pthread_join in -lpthread... yes
configure: creating ./config.status
config.status: creating platform.inc
[root@blog.m264.com ~]$ make
D: =build
C: ./decoder.c
C: ./encoder.c
C: ./xvid.c
C: bitstream/bitstream.c
C: bitstream/cbp.c
C: bitstream/mbcoding.c
C: dct/fdct.c
C: dct/idct.c
C: dct/simple_idct.c
C: image/colorspace.c
C: image/image.c
C: image/interpolate8x8.c
C: image/font.c
C: image/postprocessing.c
C: image/qpel.c
C: image/reduced.c
C: motion/estimation_bvop.c
../../src/motion/estimation_bvop.c: In function ‘SMPMotionEstimationBVOP’:
../../src/motion/estimation_bvop.c:1107: 警告: unused variable ‘f_mbs’
C: motion/estimation_common.c
C: motion/estimation_gmc.c
C: motion/estimation_pvop.c
../../src/motion/estimation_pvop.c: In function ‘MotionEstimation’:
../../src/motion/estimation_pvop.c:912: 警告: unused variable ‘skip_thresh’
../../src/motion/estimation_pvop.c:907: 警告: unused variable ‘stat_thresh’
../../src/motion/estimation_pvop.c: In function ‘MotionEstimateSMP’:
../../src/motion/estimation_pvop.c:1015: 警告: unused variable ‘skip_thresh’
../../src/motion/estimation_pvop.c:1008: 警告: unused variable ‘stat_thresh’
C: motion/estimation_rd_based.c
C: motion/estimation_rd_based_bvop.c
C: motion/gmc.c
C: motion/motion_comp.c
C: motion/vop_type_decision.c
C: motion/sad.c
C: prediction/mbprediction.c
C: plugins/plugin_single.c
C: plugins/plugin_2pass1.c
C: plugins/plugin_2pass2.c
C: plugins/plugin_lumimasking.c
C: plugins/plugin_dump.c
C: plugins/plugin_psnr.c
C: plugins/plugin_ssim.c
C: quant/quant_h263.c
C: quant/quant_matrix.c
C: quant/quant_mpeg.c
C: utils/emms.c
C: utils/mbtransquant.c
C: utils/mem_align.c
C: utils/mem_transfer.c
C: utils/timer.c
L: libxvidcore.a
L: libxvidcore.so.4.2

---------------------------------------------------------------
Xvid has been successfully built.

* Binaries are currently located in the '=build' directory
* To install them on your system, you can run '# make install'
as root.
---------------------------------------------------------------
make install
D: /usr/local/lib
I: /usr/local/lib/libxvidcore.so.4.2
I: /usr/local/lib/libxvidcore.a
D: /usr/local/include
I: /usr/local/include/xvid.h

ClipBucketで動画をアップロードすると500エラーが表示される

ClipBucketで動画をアップロードすると500エラーが表示されるときはまずhttpdのログを確認してみましょう

[root@blog.m264.com ~]$ tail -n 1 /var/log/httpd/error_log
[Thu Sep 30 13:16:19 2010] [error] [client 192.168.3.4] PHP Warning: POST Content-Length of 10948294 bytes exceeds the limit of 8388608 bytes in Unknown on line 0


POST Content-Length of 10948294 bytes exceeds the limit of 8388608 bytes

要は
え??10MBもアップするの!? お話じゃぁ8MBって聞いてたけど・・・・ (´・ω・`)
って行ってるので

10MBでも受け付けてもらえるようにお話を通します←

まずphp.iniを編集します
[root@blog.m264.com ~]$ vim /etc/php.ini
477行のpost_max_sizeを
post_max_size = 100M
とかにしちゃいます
ついでに
582行とかも弄っちゃいます
upload_max_filesize = 100M

いじり終わったら保存しちゃいます
file_uploads = On

; 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 = 200M


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

"/etc/php.ini" 1222L, 45090C 書込み 582,1 47%
話が通ったようなのでhttpdさんに報告しましょう←
[root@blog.m264.com ~]$ service httpd reload
httpd を再読み込み中: [ OK ]

2010年9月30日木曜日

CentOS5.5にMP4Boxをインストールする

ffmpegやflvtool2はyum(rpmforge)からインストールできるのですが MP4Boxは無いようなのでソースファイルからコンパイルします

最初に必要なパッケージを追加します
現に入っている場合は飛ばして下さい
[root@blog.m264.com ~]$ yum install gcc gcc-c++ freeglut-devel which
===================================================================================
 Package                     Arch        Version              Repository   Size
===================================================================================
Installing:
 gcc-c++                     i386        4.1.2-48.el5         base        3.4 M
 freeglut-devel              i386        2.4.0-7.1.el5        base        98 k
Installing for dependencies:
 libstdc++-devel             i386        4.1.2-48.el5         base        2.8 M
 freeglut                    i386        2.4.0-7.1.el5        base        142 k
Transaction Summary
====================================================================================
Install       4 Package(s)
Upgrade       0 Package(s)

MP4Boxをダウンロードします
[root@blog.m264.com ~]$ wget http://short.m264.info/gpac-045-tar
--2010-09-30 10:36:10--  http://short.m264.info/gpac-045-tar
short.m264.info をDNSに問いあわせています... 168.143.174.97
short.m264.info|168.143.174.97|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 4269054 (4.1M) [application/x-gzip]
`gpac-0.4.5.tar.gz' に保存中

100%[===========================================>] 4,269,054    896K/s 時間 4.8s

2010-09-30 10:36:17 (866 KB/s) - `gpac-0.4.5.tar.gz' へ保存完了 [4269054/4269054]

[root@localhost work]#
ファイルを解凍します
[root@blog.m264.com ~]$ tar -xf ./gpac-0.4.5.tar.gz
cd ./gpac
configureしてmakeします
configureに実行権が無いので1.か2.どちらかの方法で実行して下さい
[root@blog.m264.com ~]$ chmod u+x ./configure
./configure
若しくは
[root@blog.m264.com ~]$ sh ./configure
** System Configuration
6行ぐらい出力

** GPAC 0.4.5 Core Configuration **
8行ぐらい出力

** Detected libraries **
17行ぐらい出力

** Extra Libraries used **
11行ぐらい出力

Creating config.mak
config.h is unchanged
Done - type 'make help' for make info, 'make' to build

メイクする
[root@blog.m264.com ~]$ make
なんかすごく沢山でます
正しくメイクできたらインストールする
もし失敗してたら足りないパッケージを足して再度メイクしなおし
[root@blog.m264.com ~]$ make clean
[root@blog.m264.com ~]$ make

[root@blog.m264.com ~]$ make install
install -d "/usr/local"
install -d "/usr/local/bin"
install -m 755 bin/gcc/MP4Box "/usr/local/bin"
make -C applications install
make[1]: ディレクトリ `/root/work/gpac/applications' に入ります
set -e; for i in mp4client ; do make -C $i install; done
make[2]: ディレクトリ `/root/work/gpac/applications/mp4client' に入ります
rm -f main.o extract.o ../../bin/gcc/MP4Client
make -override BUILD_INSTALL=yes all
make[3]: ディレクトリ `/root/work/gpac/applications/mp4client' に入ります
gcc -O3 -fno-strict-aliasing -Wno-pointer-sign -I/root/work/gpac/include -DGPAC_MODULES_PATH=\"/usr/local/lib/gpac\" -c -o main.o main.c
gcc -O3 -fno-strict-aliasing -Wno-pointer-sign -I/root/work/gpac/include -DGPAC_MODULES_PATH=\"/usr/local/lib/gpac\" -c -o extract.o extract.c
gcc -Wl --warn-common -o ../../bin/gcc/MP4Client main.o extract.o -L../../bin/gcc -lgpac -lz -lGL -lglut
make[3]: ディレクトリ `/root/work/gpac/applications/mp4client' から出ます
install -m 755 ../../bin/gcc/MP4Client "/usr/local/bin"
make[2]: ディレクトリ `/root/work/gpac/applications/mp4client' から出ます
make[1]: ディレクトリ `/root/work/gpac/applications' から出ます
install -d "/usr/local/lib/gpac"
install bin/gcc/*.so "/usr/local/lib/gpac"
rm -f /usr/local/lib/gpac/libgpac.so
rm -f /usr/local/lib/gpac/nposmozilla.so
strip bin/gcc/libgpac.so
install -m 755 bin/gcc/libgpac.so /usr/local/lib/libgpac-0.4.5.so
ln -sf libgpac-0.4.5.so /usr/local/lib/libgpac.so
ldconfig || true
install -d "/usr/local/man"
install -d "/usr/local/man/man1"
if [ -d doc ] ; then \
install -m 644 doc/man/mp4box.1 /usr/local/man/man1/ ; \
install -m 644 doc/man/mp4client.1 /usr/local/man/man1/ ; \
install -m 644 doc/man/gpac.1 /usr/local/man/man1/ ; \
install -d "/usr/local/share/gpac" ; \
install -m 644 doc/gpac.mp4 /usr/local/share/gpac/ ; \
fi
これでMP4Boxのインストールは完了です
[root@blog.m264.com ~]$ which MP4Box
/usr/local/bin/MP4Box
ついでにmp4boxじゃなくてMP4Boxです←これで小一時間悩んだw

CentOS5.5にffmpeg-phpをインストールする

CentOS 5.5 に ffmpeg-phpをインストールする方法
下記のパッケージをインストール済みと想定しています
  • wget
  • tar
  • make
  • gcc
  • bzip2
  • php
  • php-devel
  • ffmpeg
  • ffmpeg-devel
ffmpeg-phpをダウンロードします
[root@blog.m264.com ~]$ wget http://short.m264.info/ffmpeg-php
解凍しビルドします
[root@blog.m264.com ~]$ tar -xf ./ffmpeg-php-0.6.0.tbz2
[root@blog.m264.com ~]$ cd ./ffmpeg-php-0.6.0
[root@blog.m264.com ~]$ phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20050922
Zend Extension Api No: 220051025
[root@blog.m264.com ~]$ ./configure
checking for egrep... grep -E
checking for a sed that does not truncate output... /bin/sed
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
-----

以下略

[root@blog.m264.com ~]$ make
いろいろ出力される

----------------------------------------------------------------------
Libraries have been installed in:
/root/work/wget/ffmpeg-php-0.6.0/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'

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@blog.m264.com ~]$ make install
Installing shared extensions: /usr/lib/php/modules/
これでインストール完了です最後にhttpdをリロードします
service httpd reload
httpd を再読み込み中: [ OK ]

2010年9月28日火曜日

PHP Fatal error: Allowed memory size of ******** bytes exhausted (tried to allocate ****** bytes)
と表示された場合は単純にメモリーが足りないだけなので
/etc/php.iniの
memory_limitの量を大きくしhttpdをリロードする
service httpd reload
Reloading httpd: [ OK ]
これで実行されるはず

もしphp.iniを弄る権限が無いなら
phpファイルに
ini_set('memory_limit','10M');
と追加すればいい