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