php 提速工具eAccelerator 配置參數(shù)詳解
Jun 13, 2016 pm 12:16 PM
eaccelerator.shm_size="32"
eAccelerator 可以使用的共享內(nèi)存的數(shù)量 (以兆為單位) . "0" 是指操作系統(tǒng)的默認(rèn)值. 默認(rèn)值是 "0".可根據(jù)服務(wù)器的實際情況來調(diào)整,16,32,64,128都是可以的。
eaccelerator.cache_dir="/home/php/tmp"
這個目錄是給磁盤緩存使用. eAccelerator 在這里儲存預(yù)先編譯好的代碼, 進程數(shù)據(jù), 內(nèi)容以及用戶的自定義內(nèi)容. 同樣的數(shù)據(jù)也能被儲存在共享內(nèi)存中 (這樣可以提高訪問速度). 默認(rèn)的設(shè)置是 "/tmp/eaccelerator".
eaccelerator.enable="1"
開啟或關(guān)閉 eAccelerator。"1" 為開啟,"0" 為關(guān)閉。默認(rèn)值為 "1"。
eaccelerator.optimizer="1"
啟或關(guān)閉內(nèi)部優(yōu)化器,可以提升代碼執(zhí)行速度。"1" 為開啟,"0" 為關(guān)閉。默認(rèn)值為 "1"。
eaccelerator.check_mtime="1"
打開或者關(guān)閉 PHP 的文件修改檢查. "1" 是指打開, "0" 是指關(guān)閉. 如果您在修改以后重新編譯 PHP 的文件,那么您應(yīng)當(dāng)設(shè)置為 "1". 默認(rèn)值是 "1".
eaccelerator.debug="0"
開啟或關(guān)閉調(diào)試日志記錄。"1" 為開啟,"0" 為關(guān)閉。默認(rèn)值為 "0"。會將緩存命中得記錄寫入日志。
eaccelerator.filter=""
判斷哪些 PHP 文件必須緩存。您可以指定緩存和不緩存的文件類型(如 "*.php *.phtml"等)
如果參數(shù)以 "!" 開頭,則匹配這些參數(shù)的文件被忽略緩存。默認(rèn)值為 "",即,所有 PHP 文件都將被緩存。
eaccelerator.shm_max="0"
當(dāng)使用 " eaccelerator_put() " 函數(shù)時禁止其向共享內(nèi)存中存儲過大的文件。該參數(shù)指定允許存儲的最大值,單位:字節(jié) (10240, 10K, 1M)。"0" 為不限制。默認(rèn)值為 "0"。
eaccelerator.shm_ttl="0"
當(dāng) eAccelerator 獲取新腳本的共享內(nèi)存大小失敗時,它將從共享內(nèi)存中刪除所有在最后 "shm_ttl" 秒內(nèi)沒有存取的腳本緩存。默認(rèn)值為 "0",即:不從共享內(nèi)春中刪除任何緩存文件。
eaccelerator.shm_prune_period="0"
當(dāng) eAccelerator 獲取新腳本的共享內(nèi)存大小失敗時,他將試圖從共享內(nèi)存中刪除早于"shm_prune_period" 秒的緩存腳本。默認(rèn)值為 "0",即:不從共享內(nèi)春中刪除任何緩存文件。
eaccelerator.shm_only="0"
允許或禁止將已編譯腳本緩存在磁盤上。該選項對 session 數(shù)據(jù)和內(nèi)容緩存無效。默認(rèn)值為 "0",即:使用磁盤和共享內(nèi)存進行緩存。
eaccelerator.compress="1"
允許或禁止壓縮內(nèi)容緩存。默認(rèn)值為 "1",即:允許壓縮。
eaccelerator.compress_level="9"
指定內(nèi)容緩存的壓縮等級。默認(rèn)值為 "9",為最高等級。
eaccelerator.keys = "disk_only"
eaccelerator.session = "disk_only"
eaccelerator.content = "disk_only"
設(shè)置內(nèi)容緩存的存放的地方,可以設(shè)置為:
shm_and_disk 在共享緩存和硬盤(默認(rèn)值)
shm 默認(rèn)存在共享內(nèi)存,如果共享內(nèi)存已滿或大小超過 "eaccelerator.shm_max" 的值,就存到硬盤
shm_only 只存放在共享內(nèi)存
disk_only 只存放在硬盤
none 不緩存數(shù)據(jù)
eaccelerator.allowed_admin_path = "/var/www/html/21andy.com/eaccelerator"
這是控制面板的地址
安裝包里有個control.php,你把它復(fù)制到網(wǎng)站的任意目錄,可以用它查看和管理,這個必須指定,否則查看緩存內(nèi)容的時候會出錯
最后,來看一下我的 eAccelerator 設(shè)置
復(fù)制代碼 代碼如下:
; eaccelerator
[eaccelerator]
zend_extension="/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"
eaccelerator.shm_size="128"
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="3600"
eaccelerator.shm_prune_period="3600"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
eaccelerator.keys = "disk_only"
eaccelerator.sessions = "disk_only"
eaccelerator.content = "disk_only"
eaccelerator.allowed_admin_path = "/var/www/html/21andy.com/eaccelerator"
另外,再說下 eAccelerator 的安裝
# wget http://bart.eaccelerator.net/source/0.9.6/eaccelerator-0.9.6.tar.bz2
# tar -jxvf eaccelerator-0.9.6.tar.bz2
# cd eaccelerator-0.9.6
# /usr/local/php/bin/phpize
# ./configure --enable-eaccelerator=shared --with-php-config=/usr/local/php/bin/php-config
# make && make install

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

AgeneratorinPHPisamemory-efficientwaytoiterateoverlargedatasetsbyyieldingvaluesoneatatimeinsteadofreturningthemallatonce.1.Generatorsusetheyieldkeywordtoproducevaluesondemand,reducingmemoryusage.2.Theyareusefulforhandlingbigloops,readinglargefiles,or

To prevent session hijacking in PHP, the following measures need to be taken: 1. Use HTTPS to encrypt the transmission and set session.cookie_secure=1 in php.ini; 2. Set the security cookie attributes, including httponly, secure and samesite; 3. Call session_regenerate_id(true) when the user logs in or permissions change to change to change the SessionID; 4. Limit the Session life cycle, reasonably configure gc_maxlifetime and record the user's activity time; 5. Prohibit exposing the SessionID to the URL, and set session.use_only

You can use substr() or mb_substr() to get the first N characters in PHP. The specific steps are as follows: 1. Use substr($string,0,N) to intercept the first N characters, which is suitable for ASCII characters and is simple and efficient; 2. When processing multi-byte characters (such as Chinese), mb_substr($string,0,N,'UTF-8'), and ensure that mbstring extension is enabled; 3. If the string contains HTML or whitespace characters, you should first use strip_tags() to remove the tags and trim() to clean the spaces, and then intercept them to ensure the results are clean.

In PHP, you can use square brackets or curly braces to obtain string specific index characters, but square brackets are recommended; the index starts from 0, and the access outside the range returns a null value and cannot be assigned a value; mb_substr is required to handle multi-byte characters. For example: $str="hello";echo$str[0]; output h; and Chinese characters such as mb_substr($str,1,1) need to obtain the correct result; in actual applications, the length of the string should be checked before looping, dynamic strings need to be verified for validity, and multilingual projects recommend using multi-byte security functions uniformly.

The urlencode() function is used to encode strings into URL-safe formats, where non-alphanumeric characters (except -, _, and .) are replaced with a percent sign followed by a two-digit hexadecimal number. For example, spaces are converted to signs, exclamation marks are converted to!, and Chinese characters are converted to their UTF-8 encoding form. When using, only the parameter values ??should be encoded, not the entire URL, to avoid damaging the URL structure. For other parts of the URL, such as path segments, the rawurlencode() function should be used, which converts the space to . When processing array parameters, you can use http_build_query() to automatically encode, or manually call urlencode() on each value to ensure safe transfer of data. just

There is no legal virtual currency platform in mainland China. 1. According to the notice issued by the People's Bank of China and other departments, all business activities related to virtual currency in the country are illegal; 2. Users should pay attention to the compliance and reliability of the platform, such as holding a mainstream national regulatory license, having a strong security technology and risk control system, an open and transparent operation history, a clear asset reserve certificate and a good market reputation; 3. The relationship between the user and the platform is between the service provider and the user, and based on the user agreement, it clarifies the rights and obligations of both parties, fee standards, risk warnings, account management and dispute resolution methods; 4. The platform mainly plays the role of a transaction matcher, asset custodian and information service provider, and does not assume investment responsibilities; 5. Be sure to read the user agreement carefully before using the platform to enhance yourself

Bitcoin halving affects the price of currency through four aspects: enhancing scarcity, pushing up production costs, stimulating market psychological expectations and changing supply and demand relationships; 1. Enhanced scarcity: halving reduces the supply of new currency and increases the value of scarcity; 2. Increased production costs: miners' income decreases, and higher coin prices need to maintain operation; 3. Market psychological expectations: Bull market expectations are formed before halving, attracting capital inflows; 4. Change in supply and demand relationship: When demand is stable or growing, supply and demand push up prices.

There are two main ways to get the last N characters of a string in PHP: 1. Use the substr() function to intercept through the negative starting position, which is suitable for single-byte characters; 2. Use the mb_substr() function to support multilingual and UTF-8 encoding to avoid truncating non-English characters; 3. Optionally determine whether the string length is sufficient to handle boundary situations; 4. It is not recommended to use strrev() substr() combination method because it is not safe and inefficient for multi-byte characters.
