| 1 |
eAccelerator for PHP |
|---|
| 2 |
===================== |
|---|
| 3 |
|
|---|
| 4 |
What is eAccelerator? |
|---|
| 5 |
---------------------- |
|---|
| 6 |
eAccelerator is a free open source PHP accelerator, optimizer, encoder and |
|---|
| 7 |
dynamic content cache for PHP. It increases performance of PHP scripts by |
|---|
| 8 |
caching them in compiled state, so that the overhead of compiling is almost |
|---|
| 9 |
completely eliminated. It also optimises the script to speed up execution |
|---|
| 10 |
of PHP scripts. eAccelerator typically reduces server load and increases the |
|---|
| 11 |
speed of your PHP code by 1-10 times. |
|---|
| 12 |
|
|---|
| 13 |
eAccelerator is a fork of TurckMMCache |
|---|
| 14 |
( http://sourceforge.net/project/turckmm-cache/ by Dmitry Stogov ) |
|---|
| 15 |
|
|---|
| 16 |
eAccelerator stores compiled PHP scripts in shared memory and executes code |
|---|
| 17 |
directly from it. It creates locks only for short time, while searching |
|---|
| 18 |
compiled PHP script in the cache, so one script can be executed simultaneously |
|---|
| 19 |
by several engines. Files that can't fit in shared memory are cached on disk |
|---|
| 20 |
only. |
|---|
| 21 |
|
|---|
| 22 |
eAccelerator is compatible with Zend Optimizer's loader. Zend Optimizer must |
|---|
| 23 |
be installed after eAccelerator in php.ini. If you don't use scripts encoded |
|---|
| 24 |
with Zend Encoder we do not recommend to install Zend Optimizer with |
|---|
| 25 |
eAccelerator. |
|---|
| 26 |
|
|---|
| 27 |
eAccelerator does not work in CGI mode but it does work in Fast-CGI mode with |
|---|
| 28 |
webservers like lighttpd. |
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
Here are some other products that provide the same functionality: |
|---|
| 32 |
|
|---|
| 33 |
- Zend Performance Suite (http://www.zend.com/) |
|---|
| 34 |
- Alternative PHP Cache (http://pecl.php.net/package/APC) |
|---|
| 35 |
|
|---|
| 36 |
Download |
|---|
| 37 |
-------- |
|---|
| 38 |
Latest eAccelerator versions can be downloaded at the sourceforge page: |
|---|
| 39 |
http://sourceforge.net/projects/eaccelerator/ |
|---|
| 40 |
Development snapshots from cvs can be downloaded at |
|---|
| 41 |
http://snapshots.eaccelerator.net |
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
Requirements |
|---|
| 45 |
------------ |
|---|
| 46 |
apache >= 1.3, mod_php >= 4.1, autoconf, automake, libtool, m4 |
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
Compatibility |
|---|
| 50 |
------------- |
|---|
| 51 |
eAccelerator has been reported working with php4 and php5, php 5.1 support |
|---|
| 52 |
hasn't been integrated yet. It is being used on Linux, FreeBSD, MacOS X, |
|---|
| 53 |
Solaris and Windows with apache 1.3 and 2, lighttpd and IIS. |
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
Quick install |
|---|
| 57 |
------------- |
|---|
| 58 |
|
|---|
| 59 |
You can find more information about installation on eAccelerator website. |
|---|
| 60 |
http://eaccelerator.sourceforge.net/ |
|---|
| 61 |
|
|---|
| 62 |
Note(1): for Microsoft Windows installation, please refer to README.win32 file. |
|---|
| 63 |
|
|---|
| 64 |
Step 1. Compiling eAccelerator |
|---|
| 65 |
|
|---|
| 66 |
export PHP_PREFIX="/usr" |
|---|
| 67 |
|
|---|
| 68 |
$PHP_PREFIX/bin/phpize |
|---|
| 69 |
|
|---|
| 70 |
./configure \ |
|---|
| 71 |
--enable-eaccelerator=shared \ |
|---|
| 72 |
--with-php-config=$PHP_PREFIX/bin/php-config |
|---|
| 73 |
|
|---|
| 74 |
make |
|---|
| 75 |
|
|---|
| 76 |
You must specify the real prefix where PHP is installed in the "export" |
|---|
| 77 |
command. It may be "/usr" "/usr/local", or something else. |
|---|
| 78 |
|
|---|
| 79 |
Step 2. Installing eAccelerator |
|---|
| 80 |
|
|---|
| 81 |
make install |
|---|
| 82 |
|
|---|
| 83 |
Step 3. Configuring eAccelerator |
|---|
| 84 |
|
|---|
| 85 |
eAccelerator can be installed both as Zend or PHP extension. |
|---|
| 86 |
|
|---|
| 87 |
For eaccelerator > 0.9.1, if you have /etc/php.d directory, you should copy eaccelerator.ini inside and modify default value if you need. |
|---|
| 88 |
|
|---|
| 89 |
If not, you need to edit your php.ini file (usually /etc/php.ini). |
|---|
| 90 |
|
|---|
| 91 |
To install as Zend extension: |
|---|
| 92 |
|
|---|
| 93 |
zend_extension="/usr/lib/php4/eaccelerator.so" |
|---|
| 94 |
eaccelerator.shm_size="16" |
|---|
| 95 |
eaccelerator.cache_dir="/tmp/eaccelerator" |
|---|
| 96 |
eaccelerator.enable="1" |
|---|
| 97 |
eaccelerator.optimizer="1" |
|---|
| 98 |
eaccelerator.check_mtime="1" |
|---|
| 99 |
eaccelerator.debug="0" |
|---|
| 100 |
eaccelerator.filter="" |
|---|
| 101 |
eaccelerator.shm_max="0" |
|---|
| 102 |
eaccelerator.shm_ttl="0" |
|---|
| 103 |
eaccelerator.shm_prune_period="0" |
|---|
| 104 |
eaccelerator.shm_only="0" |
|---|
| 105 |
eaccelerator.compress="1" |
|---|
| 106 |
eaccelerator.compress_level="9" |
|---|
| 107 |
|
|---|
| 108 |
If you use thread safe build of PHP you must use "zend_extension_ts" instead |
|---|
| 109 |
of "zend_extension". |
|---|
| 110 |
|
|---|
| 111 |
To install as PHP extension: |
|---|
| 112 |
|
|---|
| 113 |
extension="eaccelerator.so" |
|---|
| 114 |
eaccelerator.shm_size="16" |
|---|
| 115 |
eaccelerator.cache_dir="/tmp/eaccelerator" |
|---|
| 116 |
eaccelerator.enable="1" |
|---|
| 117 |
eaccelerator.optimizer="1" |
|---|
| 118 |
eaccelerator.check_mtime="1" |
|---|
| 119 |
eaccelerator.debug="0" |
|---|
| 120 |
eaccelerator.filter="" |
|---|
| 121 |
eaccelerator.shm_max="0" |
|---|
| 122 |
eaccelerator.shm_ttl="0" |
|---|
| 123 |
eaccelerator.shm_prune_period="0" |
|---|
| 124 |
eaccelerator.shm_only="0" |
|---|
| 125 |
eaccelerator.compress="1" |
|---|
| 126 |
eaccelerator.compress_level="9" |
|---|
| 127 |
|
|---|
| 128 |
Step 4. Creating cache directory |
|---|
| 129 |
|
|---|
| 130 |
mkdir /tmp/eaccelerator |
|---|
| 131 |
chmod 0777 /tmp/eaccelerator |
|---|
| 132 |
|
|---|
| 133 |
|
|---|
| 134 |
Configuration Options |
|---|
| 135 |
--------------------- |
|---|
| 136 |
|
|---|
| 137 |
eaccelerator.shm_size |
|---|
| 138 |
The amount of shared memory (in megabytes) that eAccelerator will use. |
|---|
| 139 |
"0" means OS default. Default value is "0". |
|---|
| 140 |
|
|---|
| 141 |
eaccelerator.cache_dir |
|---|
| 142 |
The directory that is used for disk cache. eAccelerator stores precompiled |
|---|
| 143 |
code, session data, content and user entries here. The same data can be |
|---|
| 144 |
stored in shared memory also (for more quick access). Default value is |
|---|
| 145 |
"/tmp/eaccelerator". |
|---|
| 146 |
|
|---|
| 147 |
eaccelerator.enable |
|---|
| 148 |
Enables or disables eAccelerator. Should be "1" for enabling or "0" for |
|---|
| 149 |
disabling. Default value is "1". |
|---|
| 150 |
|
|---|
| 151 |
eaccelerator.optimizer |
|---|
| 152 |
Enables or disables internal peephole optimizer which may speed up code |
|---|
| 153 |
execution. Should be "1" for enabling or "0" for disabling. Default value |
|---|
| 154 |
is "1". |
|---|
| 155 |
|
|---|
| 156 |
eaccelerator.debug |
|---|
| 157 |
Enables or disables debug logging. Should be "1" for enabling or "0" for |
|---|
| 158 |
disabling. Default value is "0". |
|---|
| 159 |
|
|---|
| 160 |
eaccelerator.check_mtime |
|---|
| 161 |
Enables or disables PHP file modification checking . Should be "1" for |
|---|
| 162 |
enabling or "0" for disabling. You should set it to "1" if you want to |
|---|
| 163 |
recompile PHP files after modification. Default value is "1". |
|---|
| 164 |
|
|---|
| 165 |
eaccelerator.filter |
|---|
| 166 |
Determine which PHP files must be cached. You may specify the number of |
|---|
| 167 |
patterns (for example "*.php *.phtml") which specifies to cache or not to |
|---|
| 168 |
cache. If pattern starts with the character "!", it means to ignore files |
|---|
| 169 |
which are matched by the following pattern. Default value is "" that means |
|---|
| 170 |
all PHP scripts will be cached. |
|---|
| 171 |
|
|---|
| 172 |
eaccelerator.shm_max |
|---|
| 173 |
Disables putting large values into shared memory by " eaccelerator_put() " |
|---|
| 174 |
function. It indicates the largest allowed size in bytes (10240, 10K, 1M). |
|---|
| 175 |
The "0" disables the limit. Default value is "0". |
|---|
| 176 |
|
|---|
| 177 |
eaccelerator.shm_ttl |
|---|
| 178 |
When eaccelerator fails to get shared memory for new script it removes all |
|---|
| 179 |
scripts which were not accessed at last "shm_ttl" seconds from shared |
|---|
| 180 |
memory. Default value is "0" that means - don't remove any files from |
|---|
| 181 |
shared memory. |
|---|
| 182 |
|
|---|
| 183 |
eaccelerator.shm_prune_period |
|---|
| 184 |
When eaccelerator fails to get shared memory for new script it tryes to |
|---|
| 185 |
remove old script if the previous try was made more then |
|---|
| 186 |
"shm_prune_period" seconds ago. Default value is "0" that means - don't |
|---|
| 187 |
try to remove any files from shared memory. |
|---|
| 188 |
|
|---|
| 189 |
eaccelerator.shm_only |
|---|
| 190 |
Enables or disables caching of compiled scripts on disk. It has no effect |
|---|
| 191 |
on session data and content caching. Default value is "0" that means - use |
|---|
| 192 |
disk and shared memory for caching. |
|---|
| 193 |
|
|---|
| 194 |
eaccelerator.compress |
|---|
| 195 |
Enables or disables cached content compression. Default value is "1" that |
|---|
| 196 |
means enable compression. |
|---|
| 197 |
|
|---|
| 198 |
eaccelerator.compress_level |
|---|
| 199 |
Compression level used for content caching. Default value is "9" which is |
|---|
| 200 |
the maximum value |
|---|
| 201 |
|
|---|
| 202 |
eaccelerator.name_space |
|---|
| 203 |
A string that's prepended to all keys. This allows two applications that |
|---|
| 204 |
use the same key names to run on the same host by setting this in .htaccess |
|---|
| 205 |
or in the main configuration file for the whole webserver. |
|---|
| 206 |
|
|---|
| 207 |
eaccelerator.keys |
|---|
| 208 |
eaccelerator.sessions |
|---|
| 209 |
eaccelerator.content |
|---|
| 210 |
Determine where keys, session data and content will be cached. The possible |
|---|
| 211 |
values are: |
|---|
| 212 |
"shm_and_disk" - cache data in shared memory and on disk (default value) |
|---|
| 213 |
"shm" - cache data in shared memory or on disk if shared memory |
|---|
| 214 |
is full or data size greater then "eaccelerator.shm_max" |
|---|
| 215 |
"shm_only" - cache data in shared memory |
|---|
| 216 |
"disk_only" - cache data on disk |
|---|
| 217 |
"none" - don't cache data |
|---|
| 218 |
|
|---|
| 219 |
eaccelerator.allowed_admin_path |
|---|
| 220 |
The script paths that are allowed to get admin information and do admin |
|---|
| 221 |
controls |
|---|
| 222 |
|
|---|
| 223 |
Control panel and disassembler |
|---|
| 224 |
------------------------------ |
|---|
| 225 |
|
|---|
| 226 |
If you want to use the control-panel you need to compile eAccelerator with |
|---|
| 227 |
--with-eaccelerator-info which is the default value. |
|---|
| 228 |
You need to copy the control.php file to your webroot and set the path to it |
|---|
| 229 |
in the php.ini or eaccelerator.ini in the eaccelerator.allowed_admin_path |
|---|
| 230 |
directive. If you don't do this you wont be able to see much information and |
|---|
| 231 |
can't control eAccelerator. |
|---|
| 232 |
You can set the username and password needed to access the control-panel in |
|---|
| 233 |
the control.php file. |
|---|
| 234 |
|
|---|
| 235 |
When you compile eAccelerator with --with-eaccelerator-disassembler you need |
|---|
| 236 |
to place the dasm.php and PHP_Highlight.php file also in the same directory |
|---|
| 237 |
as the control.php file. The disassembler requires PHP to be compiled with |
|---|
| 238 |
tokenizer support (--enable-tokenizer). |
|---|
| 239 |
You can set the username and password needed to access the disassembler at the |
|---|
| 240 |
top of dasm.php. |
|---|
| 241 |
|
|---|
| 242 |
eAccelerator API |
|---|
| 243 |
---------------- |
|---|
| 244 |
|
|---|
| 245 |
API documentation can be found on this website: http://bart.eaccelerator.net/doc/phpdoc/ |
|---|
| 246 |
|
|---|
| 247 |
Contact us |
|---|
| 248 |
---------- |
|---|
| 249 |
You can contact us with questions, patches or bugs, by sending an email to |
|---|
| 250 |
Bart Vanbrabant <zoeloelip at users.sourceforge.net> |
|---|