linlu11 的博客

eAccelerator: Installation

eAccelerator

http://www.sitebuddy.com/PHP/Accelerators/eAccelerator

Php Accelerators | PHP Featured

We have been using this PHP accelerator (0.9.X), on multiple servers, for a long time. It's used on some high traffic sites without any problem.

Install:
a) Download a copy of eAccelerator that is compatible with your version of PHP.
This can be an issue with eAccelerator. Sometimes it can take a little time before the Windows binaries are available for the most recent version of PHP.

Windows binaries:
Since the release of the windows binaries are not always available, I decided to start offering eAccelerator windows binaries.

b) Copy a compatible eaccelerator.dll to your PHP extensions folder (like: c:\php\extensions replace with your actual folder location).
Make sure the configuration directive extension_dir in your php.ini is properly pointing to your extensions folder.
Like: extension_dir = "c:/php/extensions"

c) Create a folder (with the appropriate permissions) for the temporary cached files.
For example: D:\tmp\eaccelerator

d) Add the following to your php.ini (as the first loaded extension):
extension="eaccelerator.dll"
eaccelerator.shm_size="64" ; 20MB per heavy site ?
eaccelerator.cache_dir="D:\tmp\eaccelerator"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
; 0 should be faster but will skip checking the modified date on your cached files eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="0" ( I have used 3600 = 1 hour)
eaccelerator.shm_prune_period="0" ( testing 1800)
eaccelerator.shm_only="0" (testing 1 this seem noticeably faster?)
eaccelerator.compress="1"
eaccelerator.compress_level="9"
eaccelerator.keys = "shm" (testing)
eaccelerator.sessions = "shm" (testing)
eaccelerator.content = "shm" (testing)
eaccelerator.admin.name="yourusername" (upto eAccelerator 0.9.4)
eaccelerator.admin.password="yourpassword" (upto eAccelerator 0.9.4)
eaccelerator.allowed_admin_path = "C:\MySites\sitebuddy\wwwroot\control.php" (NEW in eAccelerator 0.9.5)

e) Restart your Web Server.

f) WEB interface eAccelerator 0.9.4:
This accelerator provides a real nice web interface.
Use the provided eaccelerator.php (control.php in eAccelerator 0.9.5) to get data and perform certain operations. I recommend also renaming this file (for better security).

Also read the "readme" for how to implement password security between your eAccelerator 0.9.4 install and this script (a password encryption script is provided).
Basically you will end up with 2 new directives in your php.ini:
eaccelerator.admin.name="PhpAdminName"
eaccelerator.admin.password="$2$avd2.M04.$YOURAHsPASSWORDdsesENCRYPTEDdcETRmK3"

and a modified eaccelerator.php like:

<?php
$_SERVER['PHP_AUTH_USER'] = "PhpAdminName";
$_SERVER['PHP_AUTH_PW'] = "ClearVersionOfThePassword";

if (function_exists("eaccelerator")) {
eaccelerator();
} else {
echo "<html><head><title>eAccelerator</title></head><body><h1 align=\"center\">eAccelerator is not installed</h1></body></html>";
} ?>

Note: To get the encrypted password you basically type in a dos windows: "php -q eaccelerator_password.php"

g) WEB interface eAccelerator 0.9.5 (New)
With eAccelerator 0.9.5 the file eaccelerator.php was renamed control.php. I recommend also renaming this file (for better security like control545722.php).

In this file (control.php) you will see the default userID and password (you should change these values):
/** config **/
$user = "admin";
$pw = "eAccelerator";
/** /config **/

Please note that as of 08_10_2006 0.9.5 is still not released. We are currently using Release Candidate 1 (RC1).

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.
eaccelerator.shm_only
Enables or disables caching of compiled scripts on disk. It has no effect on session data and content caching. Default value is "0" that means - use disk and shared memory for caching.
eaccelerator.compress
Enables or disables cached content compression. Default value is "1" that means enable compression.
eaccelerator.compress_level
Compression level used for content caching. Default value is "9" which is the maximum value
eaccelerator.keys
eaccelerator.sessions

eaccelerator.content
Determine where keys, session data and content will be cached. The possible values are:
"shm_and_disk" - cache data in shared memory and on disk (default value)
"shm" - cache data in shared memory or on disk if shared memory
is full or data size greater then "eaccelerator.shm_max"
"shm_only" - cache data in shared memory
"disk_only" - cache data on disk
"none" - don't cache data
eaccelerator.allowed_admin_path (NEW in eAccelerator 0.9.5)
The script paths that are allowed to get admin information and do admin controls.


This module also provides: eLoader (I never used it...)
eLoader is PHP extension that can load scripts which encoded by eAccelerator without eAccelerator. It is a PHP extension and it should be compatible with Zend Optimizer, Zend Performance Suite, ionCube loader, PHP Accelerator and other PHP extensions.

Official project page for eAccelerator.

EA crashing php on IIS 6

im using the dll 0.9.4 sitebuddy2 have tried all versions. Works SUPER FAST however the w3wp.exe php worker process don't seems to flush cache and with every hour that passes the mem usage of w3wp.exe grows. from 20MB to 30MP to 100MB to 200MB etc till it slows server and i have to restart service.

Tried using the dll as zend_extention and just as extention. Nothing.

In IIS apppool i've go to the advanced setting and set the w3wp.exe to recycle after 64MB. This works during low traffic but with high traffic somtimes the process recycles during a query and it puts a yellow alert error in eventlog that says it closed unexpectedly or had fatal communication error with http.

Anyway thanks to sitebuddy the EA is FAST! Just the mem hogging is causing crashes. I removed for now but check back often for an update.

i'm running ISAPI with NO ERRORS. I've read and tried a ton of solution in the past 2 weeks from permissions to removing zend to adding a more memory to server. nothing.

Same problem

Same problem - very fast when works - problem is doesn't work for too long at one time

Hi hydn, Which PHP version

Hi hydn,

Which PHP version are u running ?

What are your eaccelerator settings ?

If possible, could you copy your post in the support forums:
eAccelerator support forum

Thx,
Chris

posted on 2009-11-07 11:27  linlu11  阅读(453)  评论(0编辑  收藏  举报

导航