CentOSにphpコンパイラのapcをインストール

Posted by admin | CentOS, PEAR, PECL, PHP | 火曜日 4 3月 2008 4:02 PM

phpを高速化させるapcをインストールしようと思いやってみたのですが、
エラーではまってしまったので内容を備忘録の為に残しておく。


まずは、peclでインストール出来るということだったので
単純に下記のコマンドを入力。するとエラーが。。。


# pecl install apc

downloading APC-3.0.16.tgz ...
Starting to download APC-3.0.16.tgz (114,298 bytes)
.............done: 114,298 bytes
45 source files, building
running: phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
1. Use apxs to set compile flags (if using APC with Apache)? : yes

1-1, 'all', 'abort', or Enter to continue:
building in /var/tmp/pear-build-root/APC-3.0.16
running: /var/tmp/APC/configure --with-apxs
checking for egrep... grep -E
checking for a sed that does not truncate output... /bin/sed
checking for gcc... no
checking for cc... no
checking for cc... no
checking for cl... no
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
ERROR: `/var/tmp/APC/configure --with-apxs' failed


何やら、Cコンパイラが無いとの事。
これに気付くのに凄く時間が掛ってしまった。。。

コンパイラが無いとの事なので、早速yumでインストール


# yum install gcc

# yum install gcc-c++




で、もう一度peclコマンドを入力


# pecl install apc

Build process completed successfully
Installing '/usr/lib/php/modules/apc.so'
install ok: channel://pecl.php.net/APC-3.0.16
configuration option "php_ini" is not set to php.ini location
You should add "extension=apc.so" to php.ini


すると今度は無事にインストール出来ました^^
でも、まだiniファイルを作らなきゃダメみたいなので

apc.iniファイルを新規追加。


# vi /etc/php.d/apc.ini

extension=apc.so



次に、apacheの再起動


# /etc/init.d/httpd restart
httpd を停止中: [ OK ]
httpd を起動中: [ OK ]



最後に、phpinfo()で[apc]の項目があれば完了!!





2008年03月のpearインストール済みリスト

Posted by admin | PEAR, PHP | 火曜日 4 3月 2008 2:51 PM

2008年03月時点でのpearライブラリのインストール済みリスト

=========================================
Package Version State
Archive_Tar 1.3.2 stable
Auth_SASL 1.0.2 stable
Cache_Lite 1.7.2 stable
Console_Getopt 1.2.3 stable
DB 1.7.13 stable
HTTP_Session2 0.7.1 beta
MDB2 2.4.1 stable
MDB2_Driver_mysql 1.4.1 stable
MDB2_Driver_pgsql 1.4.1 stable
Mail 1.1.14 stable
Net_SMTP 1.2.11 stable
Net_Socket 1.0.8 stable
PEAR 1.7.1 stable
Pager 2.4.5 stable
Structures_Graph 1.0.2 stable
XML_Parser 1.2.8 stable
XML_RPC 1.5.1 stable
XML_RSS 0.9.2 stable
XML_Tree 1.1 stable





apacheのhttpd.confの変更箇所

Posted by admin | apache | 火曜日 4 3月 2008 12:30 PM

apacheのhttpd.confの変更箇所の備忘録。


まずは、ディレクトリインデックス


DirectoryIndex index.html index.html.var #[index.php]を追加


後々追加予定。





php.iniの変更箇所

Posted by admin | PHP | 火曜日 4 3月 2008 10:15 AM

php.iniの変更箇所の備忘録。

まずは、リソースリミットの変更
;;;;;;;;;;;;;;;;;;;
; Resource Limits ;
;;;;;;;;;;;;;;;;;;;


max_execution_time = 30 ;少し増やす
max_input_time = 60 ;少し増やす
memory_limit = 32M ;[64M]に変更



次は、エラーリポート
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Error handling and logging ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


error_reporting = E_ALL ;[E_ALL | E_STRICT]に変更
display_errors = Off ;開発環境では[On]にするが、本番では[Off]
log_errors_max_len = 1024 ;[4096]に変更



データハンドリング
;;;;;;;;;;;;;;;;;
; Data Handling ;
;;;;;;;;;;;;;;;;;


post_max_size = 8M



インクルードパス
;;;;;;;;;;;;;;;;;;;;;;;;;
; Paths and Directories ;
;;;;;;;;;;;;;;;;;;;;;;;;;


include_path = ".:/php/includes" ;読み込みに必要なパスを追加



ファイルアップロード
;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;


upload_max_filesize = 2M ;少し増やす



mbstring 文字コード設定(UTF-8の場合)
[mbstring]


default_charset = "iso-8859-1" ;UTF-8に変更
mbstring.internal_encoding = EUC-JP ;UTF-8に変更
mbstring.http_input = auto
mbstring.http_output = SJIS ;UTF-8に変更
mbstring.encoding_translation = Off ;Onに変更
mbstring.detect_order = auto ;UTF-8,EUC-JP,SJIS,JIS,ASCIIに変更



とりあえず、こんな感じ。
残りは必要に応じて設定する。



参考サイト:
php.ini推奨設定