This article provides a detailed analysis of the installation and use of eAccelerator. For more information, see
1. install PHPeAccelerator
To renew,
Compile:
The code is as follows:
$ PHP_PREFIX/bin/phpize
./Configure -- enable-shared -- with-php-config = $ PHP_PREFIX/bin/php-config
Make
Installation:
The code is as follows:
Makeinstall
Modify php. ini:
The code is as follows:
Extension = "eaccelerator. so"
Eaccelerator. shm_size = "16"
Eaccelerator. cache_dir = "/tmp/eaccelerator"
Eaccelerator. enable = "1"
Eaccelerator. optimizer = "1"
Eaccelerator. check_mtime = "1"
Eaccelerator. debug = "0"
Eaccelerator. filter = ""
Eaccelerator. shm_ttl = "0"
Eaccelerator. shm_prune_period = "0"
Eaccelerator. shm_only = "0"
Create cache Directory:
The code is as follows:
Mkdir/tmp/eaccelerator
Chmod0777/tmp/eaccelerator
II. PHPeAccelerator configuration options
Eaccelerator. shm_size
Used to set the allocation EAcceleratorUsed for caching PhpMaximum shared memory, in the unit MbIf it is set 0The default size is used. In LinuxOne in the system ProcessThe maximum memory that can be allocated is /Proc/sys/kernel/shmmaxSo if EAThe configured memory exceeds this value, EAInitialization fails. ShmmaxThe unit is byte ( Bytes)
Eaccelerator. cache_dir
Used to set the hard disk cache directory.EAUsed to store pre-compiled code,SessionData, content, and user portal. The default value is"/Tmp/eaccelerator".
Eaccelerator. enable
Used to set whether to enable or disableEAccelerator, Set1To enable, set0Is disabled.
Eaccelerator. optimizer
Enable or disable optimization to accelerate code execution.1To enable,0To disable the function, the optimization only occurs when the script is compiled and is cached.
Eaccelerator. debug
Enable or disableDebugLogs. If it is set1To print the hit information of many files to the log. TroubleshootingEAccelerator.
Eaccelerator. check_mtime
In each hitEacceleratorCheck the modification time of the script to determine whether the script needs to be re-compiled based on the change. Although checking is faster than opening a file and compiling it, it still brings about some overhead, because every time a stateful call is completed. This configuration can disable this check. However, the disadvantage of closing the check is that each time the file is updated, you need to manually clear it.Cache. The default check is enabled,1Yes,0Yes.
Eaccelerator. filter
Used to determine whichPhpThe file is cached. You can use wildcards (for example"*. Php *. phtml") To matchPhpScript. If"! "This parameter is null by default and can be cached for all compiledPhpNote thatEaccelerator. filterNot based onURLWork, but based on the absolute path of the file, such as the definition"! /Home"Then all/HomeDirectory scripts are not cached. To define multiple matches, use spaces or tabs instead of commas.
Eaccelerator. shm_ttl
WhenEAceleratorWhen there is no free shared memory, the minimumShm_ttlScripts that have not been accessed in the specified number of seconds are released from the cache. the default value is0, IndicatesEANo cache is released.
Eaccelerator. shm_prune_period
When there is not enough memory for caching,EAThe cache will be cleared more than the last timeShm_prune_periodAttempt to clear the expired script again in the specified number of seconds. The default value is0,EAExpired scripts will not be cleared from the cache.
Eaccelerator. shm_only
Enable or disable disk caching. This option isSessionThe cache of data and content is ineffective. The default value is0, AllowEAUse disks and memory for caching.
Eaccelerator. allowed_admin_path
Enable or disable disk caching. This option isSessionThe cache of data and content is ineffective. The default value is0, AllowEAUse disks and memory for caching.
3. monitoring and management of PHPeAccelerator
EAccelerator provides control. php for monitoring and managing eAccelerator cache. Put control. php in the website directory, modify the account and password, and you can monitor and manage the eAccelerator cache through the browser.
Control. php 23rd and 24 rows:
The code is as follows:
$ User = "admin ";
$ Pw = "password ";