分類
PHP

eAccelerator安裝好囉

久聞 eAccelerator 大名, 今天同事在一台 BSD 的環境下安裝好 php 的 eAccelerator 的組件, 據說可以大幅提昇 php 效能, 可想見, 將 php build 好的 binary code cache 在目錄下, 應該對於 php 的效能有顯著提昇沒錯, 於是就開始著手安裝 eAccelerator 囉…

我是參考了這篇文章, http://www.tiec.tp.edu.tw/lifetype/post/102/5552, 感謝原作者用心說明, 接下來進行安裝, 由於我的環境是 appserv, 所以要先到 http://www.arnot.info/eaccelerator/ 找對應版本的 eAccelerator dll 版本, 下載後, copy 至 php 的 extension 目錄下, 並進行 php.ini 的調整(特別注意是eaccelerator.cache_dir 參數, 記得要先開好目錄, 這樣 eAccelerator 才能將 build 好的 binary code 存放在該位置), 完成後就直接重起 apache 即可, 接下來利用 phpinfo 來 check 一下(或利用指令 php -v 來觀察), 畫面中出現如下的 eAccelerator 字眼就代表安裝成功囉:

接下來就 check 看網頁工作是否正常, 原則上第一次會進行 build binary 的動作並存在指定的目錄下, 會稍微慢一點點, 但第二次之後, 就會跑得飛快, 相信你會滿意地.

各參數所代表的意義如下:

Configuration Options (From the Readme file):
eaccelerator.shm_size
The amount of shared memory (in megabytes) that eAccelerator will use. “0” means OS default. Default value is “0”.
eaccelerator.cache_dir
The directory that is used for disk cache. eAccelerator stores precompiled code, session data, content and user entries here. The same data can be stored in shared memory also (for quicker access). Default value is “/tmp/eaccelerator”.
eaccelerator.enable
Enables or disables eAccelerator. Should be “1” for enabling or “0” for disabling. Default value is “1”.
eaccelerator.optimizer
Enables or disables internal peephole optimizer which may speed up code execution. Should be “1” for enabling or “0” for disabling. Default value is “1”.
eaccelerator.debug
Enables or disables debug logging. Should be “1” for enabling or “0” for disabling. Default value is “0”.
eaccelerator.log_file
Set the log file for eaccelerator. When this option isn’t set then the data will be logged to stderr
eaccelerator.name_space
A string that’s prepended to all keys. This allows two applications that use the same key names to run on the same host by setting this in .htaccess or in the main configuration file for the whole web server.
eaccelerator.check_mtime
Enables or disables PHP file modification checking . Should be “1” for enabling or “0” for disabling. You should set it to “1” if you want to recompile PHP files after modification. Default value is “1”.
eaccelerator.filter
Determine which PHP files must be cached. You may specify the number of patterns (for example “*.php *.phtml”) which specifies to cache or not to cache. If pattern starts with the character “!”, it means to ignore files which are matched by the following pattern. Default value is “” that means all PHP scripts will be cached.
eaccelerator.shm_max
Disables putting large values into shared memory by ” eaccelerator_put() ” function. It indicates the largest allowed size in bytes (10240, 10K, 1M). The “0” disables the limit. Default value is “0”.
eaccelerator.shm_ttl
When eaccelerator fails to get shared memory for new script it removes all scripts which were not accessed at last “shm_ttl” seconds from shared memory. Default value is “0” that means – don’t remove any files from shared memory.
eaccelerator.shm_prune_period
When eaccelerator fails to get shared memory for new script it tries to remove old script if the previous try was made more then “shm_prune_period” seconds ago. Default value is “0” that means – don’t try to remove any files from shared memory.

繼續閱讀:
http://plog.hlps.tcc.edu.tw/plog/post/1/2667
bsd下的安裝(也介紹了將php編碼的方法):
http://www.wretch.cc/blog/cdsheen&article_id=2192329
eAccelerator參數及功能介紹:
http://x.discuz.net/65438/viewspace-21457.html
windows下的版本安裝說明:
http://www.sitebuddy.com/PHP/Accelerators/eAccelerator

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。