root/eaccelerator/tags/start/README

Revision 5, 10.9 kB (checked in by anonymous, 4 years ago)

This commit was manufactured by cvs2svn to create branch 'eAccelerator'.

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