root/eaccelerator/tags/0.9.1/README

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

Cosmetic change: remove any turckmmcache version reference.

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