root/eaccelerator/tags/0.9.2a/README

Revision 28, 10.9 kB (checked in by franck34, 4 years ago)

adding eacceleratoris a fork of turckmmcache

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
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. Also it uses some optimizations 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 contains a PHP encoder and loader. You  can  encode  PHP  scripts
23 using encoder.php in order to distribute them without sources.  Encoded  files
24 can be run on any site which  runs  PHP  with  eAccelerator.  The  sources  of
25 encoded scripts can't be restored because they are stored in a  compiled  form
26 and the encoded version doesn't contain the source. Of course, some  internals
27 of the scripts can  be  restored  with  different  reverse  engineering  tools
28 (disassemblers, debuggers, etc), but it is not trivial.
29
30 eAccelerator is compatible with Zend Optimizer's loader. Zend  Optimizer  must
31 be installed after eAccelerator in php.ini. If you don't use  scripts  encoded
32 with Zend Encoder then we do not recommend you  install  Zend  Optimizer  with
33 eAccelerator.
34
35 eAccelerator does not work in CGI mode.
36
37
38 Here are some other products that provide the same functionality:
39
40  - Zend Performance Suite (http://www.zend.com/)
41  - PHP Accelerator (http://www.php-accelerator.co.uk/)
42  - Alternative PHP Cache (http://apc.communityconnect.com/)
43  - AfterBurner Cache (http://www.bwcache.bware.it/)
44
45
46 Where is eAccelerator already used?
47 -----------------------------------
48 The following you will find a list of sites that use eAccelerator. If you want
49 to be added, please send e-mail to frankalcantara at users.sourceforge.net
50
51  - HomePage Title (http://www.xxx.com)
52    homepage description
53
54
55 Download
56 --------
57 Latest eAccelerator versions can be downloaded at the sourceforge page:
58 http://sourceforge.net/projects/eaccelerator/
59
60
61 Requirements
62 ------------
63 apache 1.3, mod_php 4.1, autoconf, automake, libtool, m4
64
65
66 Compatibility
67 -------------
68 This version of the eAccelerator has been successfully tested on PHP
69 4.1.0-4.3.3 under RedHat Linux 7.0, 7.3, 8.0 and Windows with Apache 1.3
70 and Apache 2.0.
71
72
73 Quick install
74 -------------
75 Step 1. Compiling eAccelerator
76
77   export PHP_PREFIX="/usr"
78  
79   $PHP_PREFIX/bin/phpize
80  
81   ./configure \
82   --enable-eaccelerator=shared \
83   --with-php-config=$PHP_PREFIX/bin/php-config
84  
85   make
86
87   You must specify the real prefix where PHP is installed in the "export"
88   command. It may be "/usr" "/usr/local", or something else.
89
90 Step 2. Installing eAccelerator
91
92   make install
93
94 Step 3. Configuring eAccelerator
95
96 eAccelerator can be installed both as Zend or PHP extension.
97
98 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.
99
100 If not, you need to edit your php.ini file (usually /etc/php.ini).
101
102 To install as Zend extension:
103
104   zend_extension="/usr/lib/php4/eaccelerator.so"
105   eaccelerator.shm_size="16"
106   eaccelerator.cache_dir="/tmp/eaccelerator"
107   eaccelerator.enable="1"
108   eaccelerator.optimizer="1"
109   eaccelerator.check_mtime="1"
110   eaccelerator.debug="0"
111   eaccelerator.filter=""
112   eaccelerator.shm_max="0"
113   eaccelerator.shm_ttl="0"
114   eaccelerator.shm_prune_period="0"
115   eaccelerator.shm_only="0"
116   eaccelerator.compress="1"
117   eaccelerator.compress_level="9"
118
119   If you use thread safe build of PHP you must use "zend_extension_ts" instead
120   of "zend_extension".
121
122 To install as PHP extension:
123
124   extension="eaccelerator.so"
125   eaccelerator.shm_size="16"
126   eaccelerator.cache_dir="/tmp/eaccelerator"
127   eaccelerator.enable="1"
128   eaccelerator.optimizer="1"
129   eaccelerator.check_mtime="1"
130   eaccelerator.debug="0"
131   eaccelerator.filter=""
132   eaccelerator.shm_max="0"
133   eaccelerator.shm_ttl="0"
134   eaccelerator.shm_prune_period="0"
135   eaccelerator.shm_only="0"
136   eaccelerator.compress="1"
137   eaccelerator.compress_level="9" 
138
139 Step 4. Creating cache directory
140
141   mkdir /tmp/eaccelerator
142   chmod 0777 /tmp/eaccelerator
143
144
145 Configuration Options
146 ---------------------
147
148 eaccelerator.shm_size
149     The amount of shared memory (in megabytes) that eAccelerator will use.
150     "0" means OS default. Default value is "0".
151
152 eaccelerator.cache_dir
153     The directory that is used for disk cache. eAccelerator stores precompiled
154     code, session data, content and user entries  here. The same data  can  be
155     stored in shared memory also (for more quick access). Default value is
156     "/tmp/eaccelerator".
157
158 eaccelerator.enable
159     Enables or disables eAccelerator. Should be "1" for enabling  or  "0"  for
160     disabling. Default value is "1".
161
162 eaccelerator.optimizer
163     Enables or disables internal peephole optimizer which may  speed  up  code
164     execution. Should be "1" for enabling or "0" for disabling. Default  value
165     is "1".
166
167 eaccelerator.debug
168     Enables or disables debug logging. Should be "1" for enabling or  "0"  for
169     disabling. Default value is "0".
170
171 eaccelerator.check_mtime
172     Enables or disables PHP file modification checking .  Should  be  "1"  for
173     enabling or "0" for disabling. You should set it to "1"  if  you  want  to
174     recompile PHP files after modification. Default value is "1".
175
176 eaccelerator.filter
177     Determine which PHP files must be cached. You may specify  the  number  of
178     patterns (for example "*.php *.phtml") which specifies to cache or not  to
179     cache. If pattern starts with the character "!", it means to ignore  files
180     which are matched by the following pattern. Default value is "" that means
181     all PHP scripts will be cached.
182
183 eaccelerator.shm_max
184     Disables putting large values into shared memory by " eaccelerator_put() "
185     function. It indicates the largest allowed size in bytes (10240, 10K, 1M).
186     The "0" disables the limit. Default value is "0".
187
188 eaccelerator.shm_ttl
189     When eaccelerator fails to get shared memory for new script it removes all
190     scripts which were not accessed  at  last "shm_ttl"  seconds  from  shared
191     memory. Default value is "0" that means -  don't  remove  any  files  from
192     shared memory.
193
194 eaccelerator.shm_prune_period
195     When eaccelerator fails to get shared memory for new script  it  tryes  to
196     remove  old  script   if   the   previous   try   was   made   more   then
197     "shm_prune_period" seconds ago. Default value is "0" that  means  -  don't
198     try to remove any files from shared memory.
199
200 eaccelerator.shm_only
201     Enables or disables caching of compiled scripts on disk. It has  no  effect
202     on session data and content caching. Default value is "0" that means -  use
203     disk and shared memory for caching.
204
205 eaccelerator.compress
206     Enables or disables cached content compression. Default value is  "1"  that
207     means enable compression.
208
209 eaccelerator.compress_level
210     Compression level used for content caching.  Default value is "9" which  is
211     the maximum value
212    
213 eaccelerator.keys
214 eaccelerator.sessions
215 eaccelerator.content
216     Determine where keys, session data and content will be cached. The possible
217     values are:
218     "shm_and_disk" - cache data in shared memory and on disk (default value)
219     "shm"          - cache data in shared memory or on disk if shared memory
220                      is full or data size greater then "eaccelerator.shm_max"
221     "shm_only"     - cache data in shared memory
222     "disk_only"    - cache data on disk
223     "none"         - don't cache data
224
225
226 eAccelerator API
227 ----------------
228
229 eaccelerator_put($key, $value, $ttl=0)
230   puts the $value into shard memory for $ttl seconds.
231
232 eaccelerator_get($key)
233   returns the value from shared memory which was stored by  eaccelerator_put()
234   or null if it is not exists or was expired.
235
236 eaccelerator_rm($key)
237   removres the $key from shared memory
238
239 eaccelerator_gc()
240   removes all expired keys from shared memory
241
242 eaccelerator_lock($lock)
243   creates a lock with specified name. The lock can  be  released  by  function
244   eaccelerator_unlock() or automatic on the end of request.
245   For Example:
246   <?php
247     eaccelerator_lock("count");
248     eaccelerator_put("count",eaccelerator_get("count")+1));
249   ?>
250
251 eaccelerator_unlock($lock)
252   release lock with specified name
253
254 eaccelerator_set_session_handlers()
255   install the eaccelerator session handlers.
256   Since PHP 4.2.0 you can install eaccelerator session handlers
257   in "php.ini" by "session.save_handler=eaccelerator".
258
259 eaccelerator_cache_output($key, $eval_code, $ttl=0)
260   caches the output of $eval_code in shared memory for $ttl seconds.
261   Output can be removed from cache by calling mmcach_rm() with the same $key.
262   For Example:
263   <?php eaccelerator_cache_output('test', 'echo time(); phpinfo();', 30); ?>
264
265 eaccelerator_cache_result($key, $eval_code, $ttl=0)
266   caches the result of $eval_code in shared memory for $ttl seconds.
267   Result can be removed from cache by calling mmcach_rm() with the same $key.
268   For Example:
269   <?php eaccelerator_cache_output('test', 'time()." Hello";', 30); ?>
270
271 eaccelerator_cache_page($key, $ttl=0)
272   caches the full page for $ttl seconds.
273   For Example:
274   <?php
275     eaccelerator_cache_page($_SERVER['PHP_SELF'].'?GET='.serialize($_GET),30);
276     echo time();
277     phpinfo();
278   ?>
279
280 eaccelerator_rm_page($key)
281   removes the page which was cached by eaccelerator_cache_page() with the same
282   $key from cache
283
284 eaccelerator_encode($filename)
285   returns the encoded bytecode of compiled file $filename
286
287 eaccelerator_load($code)
288   loads script which was encoded by eaccelerator_encode()
289
290 WEB interface
291 -------------
292 eAccelerator can be managed through web interface script  eaccelerator.php. So
293 you need to put this file on  your  web  site.  For  security  reasons  it  is
294 recommended to restrict the usage of this script by your local IP.
295
296 Since version 2.3.18 admin interface may be protected by password. To generate
297 password run the eaccelerator_password.php from command line  and  follow  the
298 instruction.
299
300   $ php -q eaccelerator_password.php
301   Changing password for eAccelerator Web Interface (eaccelerator.php)
302
303   Enter admin name: admin
304   New admin password: eaccelerator
305   Retype new admin password: eaccelerator
306
307   Add the following lines into your php.ini and restart HTTPD
308
309   eaccelerator.admin.name="admin"
310   eaccelerator.admin.password="$1$0ScD9gkb$nOEmFerNMvQ576hELeLrG0"
311
312 If you use eaccelerator.php in directory that is password-protected  by  HTTPD
313 then eaccelerator's admin name and password must be the same.
314
315
316 Contact us
317 ----------
318 To contact us with questions, patches or bugs, please send e-mail to
319 Frank Alcantara <frankalcantara at users.sourceforge.net>
Note: See TracBrowser for help on using the browser.