root/eaccelerator/tags/0.9.4-rc2/README

Revision 152, 11.1 kB (checked in by zoeloelip, 3 years ago)

Fixed some typos and cleaned up the README file a bit more
Fixed some typos in README.eLoader

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