PDA

查看完整版本 : 加速您的網站 500%


uhero
2003-08-18, 05:51 PM
小弟是AppServ的愛用者...
但2.1.0中有內建ZEND (php加速器) , 但是他的MySQL 是 4.x.x
對我的VBB來說不太相容,所以就退一步使用 AppServ 1.9.0
但1.9.0中沒有 ZEND , 所以就去ZEND的網站看看有什麼新版的
拿來裝看看,原來ZEND也有分好幾版
AppServ 2.1.0 中附的是 Zend Optimizer 2.1
Zend Optimizer 是GPL版本,也就是不用錢
但往上一看 ~rusure
Zend Accelerator 3.5.0 要美金 490 元...
真是不便宜..但..自身感覺使用不用錢的Zend Optimizer一定比Zend Accelerator慢的心情引響下就到了各大論壇中做功課

發現了一套 turck MMCache
官方網站 http://www.turcksoft.com/en/e_mmc.htm
他完全是Free的,而且效能跟 Zend Accelerator差不多(網頁往下拉有各加速程式比較)

下載網址 http://sourceforge.net/project/showfiles.php?group_id=69426

我是抓 turck-mmcache-2.3.22-win32-php-4.3.0.zip
因為我的php 是 4.3.0版本的,所以這點要注意一下..不要抓錯

在來就是安裝的問題,請把下面這段加到你的php.ini最下面
P.S. 我只改這兩個地方
zend_extension_ts="d:\appserv\mmc\mmcache.dll
這個是 MMCache的目錄...應該不難吧

mmcache.cache_dir = "d:\appserv\mmc\temp
這個是 MMCache Temp的目錄,可以自行設定更改
請注意!!!! 別忘了建這個目錄




[mmcache]

; Turck MMCache is compatible with Zend Optimizer's loader. Zend Optimizer
; must be installed after Turck MMCache in php.ini. If you don't use scripts
; encoded with Zend Encoder then we do not recommend you install Zend Optimizer
; with Turck MMCache.

; Turck MMCache.

; You must uncomment one (and only one) line from the following to load
; Turck MMCache extensin.

;extension="mmcache.so"
;zend_extension="/usr/lib/php4/mmcache.so"
;zend_extension_ts="/usr/lib/php4/mmcache.so"
;extension="mmcache.dll"
zend_extension_ts="d:\appserv\mmc\mmcache.dll"
;zend_extension="d:\appserv\mmc\mmcache.dll"

mmcache.shm_size = "16"
; The amount of shared memory (in megabytes) that Turck MMCache will use.
; "0" means OS default. Default value is "0".

mmcache.cache_dir = "d:\appserv\mmc\temp"
; The directory that is used for disk cache. Turck MMCache stores precompiled
; code, session data, content and user entries here. The same data can be
; stored in shared memory also (for more quick access). Default value is
; "d:\appserv\mmc\temp".

mmcache.enable = "1"
; Enables or disables Turck MMCache. Should be "1" for enabling or
; "0" for disabling. Default value is "1".

mmcache.optimizer = "1"
; 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".

mmcache.debug = "0"
; Enables or disables debug logging. Should be "1" for enabling or
; "0" for disabling. Default value is "0".

mmcache.check_mtime = "1"
; 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".

mmcache.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.

mmcache.shm_max = "0"
; Disables putting large values into shared memory by "mmcache_put()"
; function.
; It indicates the largest allowed size in bytes (10240, 10K, 1M). The "0"
; disables the limit. Default value is "0".

mmcache.shm_ttl = "0"
; When MMCache 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.

mmcache.shm_prune_period = "0"
; When MMCache fails to get shared memory for new script it tryes 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.

mmcache.shm_only = "0"
; Enables or disables caching of compiled scripts on disk. It has no effect
; on session data and content caching (they are always cached on disk).
; Default value is "0" that means - use disk and shared memory for caching.

mmcache.compress = "1"
; Enables or disables cached content compression. Default value is "1" that
; means enable compression.





如果說,你想看看 MMCache現在的使用狀況
請更改 APACHE 的 httpd.conf
在最下面加入

# MMCACHE
Alias /mmc "d:/appserv/mmc/"
<Directory "d:/appserv/mmc/">
DirectoryIndex mmcache.php
</Directory>

這樣你要用網頁看他的情況就打
http://localhost/mmc

就ok啦...
剛試了一下...cache真的會隨著網頁的讀入而減少
但是相對的,網頁php因為不用在使用cpu編譯一次而速度上快的很多...



哈拉站長...裝看看這程式,讓你的PHPBB加速哦!!! ~youarebe: ~youarebe:

哈啦
2003-08-18, 06:23 PM
~yes 十分感謝。不過看起來好有點複雜的樣子,我現在都抱著多一事不如少一事的態度 ?:D ,有時不小心動到不該動的地方,整個就掛了。
不過我會研究一下的 :that is :

uhero
2003-08-18, 06:30 PM
看看吧