PHPを多用しているこのサイトにとってPHPの高速化は必然である。
以前Turck MMCacheを導入して対処してあったがAPCの導入に失敗しているためなんとなく満足できてなかった。
いろいろ調べたが現在無償でアップグレードできるものとして以下の組み合わせで(共存)をおこなった。
zendを後にしないとうまく動作しなかったので注意である。 それと念のためphp.iniはバックアップ
| ブログをはじめる |
eAccelerator
http://eaccelerator.net/
とりあえずSourceForge:eAcceleratorより最新版を入手
- ダウンロードしたファイルの解凍
- 解凍したフォルダに移動
- 以下のコマンド投入(当方の例)
# phpize
# ./configure --enable-eaccelerator=shared --with-php-config=/usr/local/bin/php-config
# make && make install - できあがったeaccelerator.soを正しく配置(下の例だと"/usr/local/lib/php/extensions/"に配置されてなくてはならない。)
- php.iniの編集
[eaccelerator]
zend_extension="/usr/local/lib/php/extensions/eaccelerator.so"
eaccelerator.shm_size = "32"
eaccelerator.cache_dir = "/tmp/eaccelerator"
eaccelerator.enable = "1"
eaccelerator.optimizer = "1"
eaccelerator.check_mtime = "1"
eaccelerator.debug = "0"
eaccelerator.filter = ""
eaccelerator.shm_max = "0"
eaccelerator.shm_ttl = "0"
eaccelerator.shm_prune_period = "0"
eaccelerator.shm_only = "0"
eaccelerator.compress = "1"
eaccelerator.compress_level = "9"
eaccelerator.keys = "shm_and_disk"
eaccelerator.sessions = "shm_and_disk"
eaccelerator.content = "shm_and_disk"eaccelerator.cache_dir=はキャッシュを格納する場所なので自分で作成
- apacheの再起動
Zend Optimizer 3
Zendが無償で提供するPHPコードの最適化モジュール
Zend Optimizerは、PHPコードの最適化を行ない実行速度を数%から数十%まで高速化します。
また、PHPコードのセキュリティソリューション Zend Guard (Zend Encoder/ Zend SafeGuard Suite の後継製品としてリリース予定)がエンコード(変換した)コードの実行にも使用します。
モジュールローディング方式なので、PHPをコンパイルすることなく導入できます。
Zend Optimizerは、MyZendより無償で入手(ダウンロード)できます。
導入はZend Optimizer 3 ユーザマニュアル (日本語) pdf を参考しおこなったが非常に簡単である。
- ダウンロードしたファイルの解凍
- 解凍したフォルダに移動
- リモートアクセスを考慮して以下のコマンドを投入
./install-tty - あとはphp.iniなどの場所を聞かれたのに応答していけばよい
当方の場合だと以下のようになったDo you accept the terms of this license?
Answer (yes or no) [YES]: yAnswer (yes or no) [YES]: y
Please specify the location for installing Zend Optimizer [/usr/local/Zend]:
Confirm the location of your php.ini file [/usr/local/etc]:
Are you using Apache Web server?
Answer (yes or no) [YES]: y
ctl]:Trying to determine the version of PHP.
Please wait... (this may take a few seconds)Detecting ... \ [100%]
Installing 5_1_x_comp/TS/ZendOptimizer.so \ [100%]
The following configuration changes have been made:- The php.ini file has been relocated from /usr/local/etc to /usr/local/Zend/etc
- A symbolic link for the php.ini file has been created in /usr/local/etc.
- The original php.ini was backed up to
/usr/local/etc/php.ini-zend_optimizer.bak[To continue, press Enter]
The installation has completed successfully.
Zend Optimizer is now ready for use.
You must restart your Web server for the modifications to take effect.
[To continue, press Enter]
Restart the Web server now?
Answer (yes or no) [YES]: y
Restarting Apache ...
Please wait... (this may take a few seconds)Restarting ... \ [100%]
Apache has restarted successfully.
[To continue, press Enter]
これだけである。
自動でapacheが再起動されるので確認をしよう!!
phpinfo.phpを参照し確認。当方の例だと





