久聞 eAccelerator 大名, 今天同事在一台 BSD 的環境下安裝好 php 的 eAccelerator 的組件, 據說可以大幅提昇 php 效能, 可想見, 將 php build 好的 binary code cache 在目錄下, 應該對於 php 的效能有顯著提昇沒錯, 於是就開始著手安裝 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_sizeThe amount of shared memory (in megabytes) that eAccelerator will use. "0" means OS default. Default value is "0".
eaccelerator.cache_dirThe 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.enableEnables or disables eAccelerator. Should be "1" for enabling or "0" for disabling. Default value is "1".
eaccelerator.optimizerEnables 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.debugEnables or disables debug logging. Should be "1" for enabling or "0" for disabling. Default value is "0".
eaccelerator.log_fileSet the log file for eaccelerator. When this option isn't set then the data will be logged to stderr
eaccelerator.name_spaceA 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_mtimeEnables 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.filterDetermine 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_maxDisables 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_ttlWhen 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_periodWhen 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/2667bsd下的安裝(也介紹了將php編碼的方法):
http://www.wretch.cc/blog/cdsheen&article_id=2192329eAccelerator參數及功能介紹:
http://x.discuz.net/65438/viewspace-21457.htmlwindows下的版本安裝說明:
http://www.sitebuddy.com/PHP/Accelerators/eAccelerator