Changeset 178
- Timestamp:
- 03/06/06 10:08:40 (2 years ago)
- Files:
-
- eaccelerator/trunk/ChangeLog (modified) (1 diff)
- eaccelerator/trunk/Makefile.in (modified) (1 diff)
- eaccelerator/trunk/README (modified) (2 diffs)
- eaccelerator/trunk/cache.c (modified) (6 diffs)
- eaccelerator/trunk/cache.h (modified) (1 diff)
- eaccelerator/trunk/config.m4 (modified) (4 diffs)
- eaccelerator/trunk/control.php (added)
- eaccelerator/trunk/dasm.php (added)
- eaccelerator/trunk/ea_dasm.c (added)
- eaccelerator/trunk/ea_dasm.h (added)
- eaccelerator/trunk/ea_info.c (added)
- eaccelerator/trunk/ea_info.h (added)
- eaccelerator/trunk/eaccelerator.c (modified) (12 diffs)
- eaccelerator/trunk/eaccelerator.h (modified) (2 diffs)
- eaccelerator/trunk/eaccelerator.ini (modified) (1 diff)
- eaccelerator/trunk/eaccelerator.php (deleted)
- eaccelerator/trunk/eaccelerator_password.php (deleted)
- eaccelerator/trunk/shm.c (modified) (6 diffs)
- eaccelerator/trunk/shm.h (modified) (1 diff)
- eaccelerator/trunk/webui.c (deleted)
- eaccelerator/trunk/webui.h (deleted)
- eaccelerator/trunk/x86_spinlocks.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
eaccelerator/trunk/ChangeLog
r176 r178 1 2006-03-06 Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> 2 3 * Removed the old webui and made a new controlpanel en disassembler. 4 1 5 2006-03-02 Bart Vanbrabant <bart.vanbrabant at zoeloelip.be> 2 6 eaccelerator/trunk/Makefile.in
r162 r178 1 1 LTLIBRARY_NAME = libeaccelerator.la 2 LTLIBRARY_SOURCES = eaccelerator.c optimize.c encoder.c loader.c opcodes.c content.c mm.c webui.c session.c shm.c debug.c cache.c ea_restore.c ea_store.c2 LTLIBRARY_SOURCES = eaccelerator.c optimize.c encoder.c loader.c opcodes.c content.c mm.c session.c shm.c debug.c cache.c ea_restore.c ea_store.c ea_info.c ea_dasm.c 3 3 LTLIBRARY_SHARED_NAME = eaccelerator.la 4 4 eaccelerator/trunk/README
r152 r178 225 225 "none" - don't cache data 226 226 227 eaccelerator.allowed_admin_path 228 The script paths that are allowed to get admin information and do admin 229 controls 230 231 Control panel and disassembler 232 ------------------------------ 233 234 If you want to use the control-panel you need to compile eAccelerator with 235 --with-eaccelerator-info which is the default value. 236 You need to copy the control.php file to your webroot and set the path to it 237 in the php.ini or eaccelerator.ini in the eaccelerator.allowed_admin_path 238 directive. If you don't do this you wont be able to see much information and 239 can't control eAccelerator. 240 You can set the username and password needed to access the control-panel in 241 the control.php file. 242 243 When you compile eAccelerator with --with-eaccelerator-disassembler you need 244 to place the dasm.php file also in the same directory as the control.php file. 227 245 228 246 eAccelerator API … … 290 308 loads script which was encoded by eaccelerator_encode() 291 309 292 WEB interface293 -------------294 eAccelerator can be managed through web interface script eaccelerator.php. So295 you need to put this file on your web site. For security reasons it is296 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 generate299 password run the eaccelerator_password.php from command line and follow the300 instruction.301 302 $ php -q eaccelerator_password.php303 Changing password for eAccelerator Web Interface (eaccelerator.php)304 305 Enter admin name: admin306 New admin password: eaccelerator307 Retype new admin password: eaccelerator308 309 Add the following lines into your php.ini and restart HTTPD310 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 HTTPD315 then eaccelerator's admin name and password must be the same.316 317 318 310 Contact us 319 311 ---------- eaccelerator/trunk/cache.c
r176 r178 48 48 extern int binary_zend_version; 49 49 50 static char *build_key (const char *key, int key_len, int *xlen TSRMLS_DC)50 static char *build_key(const char *key, int key_len, int *xlen TSRMLS_DC) 51 51 { 52 52 int len; … … 55 55 * namespace 56 56 */ 57 len = strlen (EAG(name_space));57 len = strlen(EAG(name_space)); 58 58 if (len > 0) { 59 59 char *xkey; 60 60 *xlen = len + key_len + 1; 61 xkey = emalloc ((*xlen) + 1);62 memcpy (xkey, EAG(name_space), len);61 xkey = emalloc((*xlen) + 1); 62 memcpy(xkey, EAG(name_space), len); 63 63 xkey[len] = ':'; 64 memcpy (xkey + len + 1, key, key_len + 1);64 memcpy(xkey + len + 1, key, key_len + 1); 65 65 return xkey; 66 66 } … … 69 69 * hostname 70 70 */ 71 len = strlen (EAG (hostname));71 len = strlen(EAG (hostname)); 72 72 if (len > 0) { 73 73 char *xkey; 74 74 *xlen = len + key_len + 1; 75 xkey = emalloc ((*xlen) + 1);76 memcpy (xkey, EAG(hostname), len);75 xkey = emalloc((*xlen) + 1); 76 memcpy(xkey, EAG(hostname), len); 77 77 xkey[len] = ':'; 78 memcpy (xkey + len + 1, key, key_len + 1);78 memcpy(xkey + len + 1, key, key_len + 1); 79 79 return xkey; 80 80 } else { … … 139 139 #ifdef ZEND_WIN32 140 140 Sleep (100); 141 /*???142 #elif defined(HAVE_SCHED_YIELD)143 sched_yield();144 */145 141 #else 146 142 struct timeval t; … … 258 254 memcpy (&q->value, val, sizeof (zval)); 259 255 q->ttl = ttl ? time (0) + ttl : 0; 256 q->create = time (0); 260 257 store_zval (&q->value TSRMLS_CC); 261 258 zend_hash_destroy (&EAG (strings)); … … 605 602 return size; 606 603 } 604 605 /* get list of all keys stored in memory that matches hostname or namespace */ 606 int eaccelerator_list_keys(zval *return_value TSRMLS_DC) 607 { 608 unsigned int i, xlen; 609 zval *list; 610 char *xkey; 611 mm_user_cache_entry *p; 612 time_t t = time (0); 613 614 // create key prefix for current host / namespace 615 xlen = strlen(EAG(name_space)); 616 if (xlen > 0) { 617 xkey = emalloc(xlen + 1); 618 memcpy(xkey, EAG(name_space), xlen); 619 } else { 620 xlen = strlen(EAG(hostname)); 621 if (xlen > 0) { 622 xkey = emalloc(xlen + 1); 623 memcpy(xkey, EAG(hostname), xlen); 624 } 625 } 626 627 // initialize return value as an array 628 array_init(return_value); 629 630 for (i = 0; i < MM_USER_HASH_SIZE; ++i) { 631 p = eaccelerator_mm_instance->user_hash[i]; 632 while(p != NULL) { 633 if (!xlen || strncmp(p->key, xkey, xlen) == 0) { 634 list = NULL; 635 ALLOC_INIT_ZVAL(list); 636 array_init(list); 637 638 if (strlen(p->key) > xlen) { 639 add_assoc_string(list, "name", (p->key) + xlen, 1); 640 } else { 641 add_assoc_string(list, "name", p->key, 1); 642 } 643 644 if (p->ttl) { 645 if (p->ttl < t) { 646 add_assoc_long(list, "ttl", (p->ttl -t)); // ttl 647 } else { 648 add_assoc_long(list, "ttl", -1); // expired 649 } 650 } else { 651 add_assoc_long(list, "ttl", 0); // no ttl 652 } 653 654 add_assoc_long(list, "created", p->create); 655 add_assoc_long(list, "size", p->size); 656 add_next_index_zval(return_value, list); 657 } 658 p = p->next; 659 } 660 } 661 662 if (xlen > 0) 663 efree(xkey); 664 return 1; 665 } 666 607 667 #endif /* HAVE_EACCELERATOR */ 668 eaccelerator/trunk/cache.h
r176 r178 43 43 size_t eaccelerator_gc (TSRMLS_D); 44 44 45 int eaccelerator_list_keys(zval *return_value TSRMLS_DC); 46 45 47 #endif /* INCLUDED_CACHE_H */ eaccelerator/trunk/config.m4
r175 r178 51 51 ]) 52 52 53 AC_ARG_WITH(eaccelerator-webui,54 [ --without-eaccelerator-webui Do not include the eaccelerator WebUI],[55 eaccelerator_webui=$withval56 ],[57 eaccelerator_webui=yes58 ])59 60 53 AC_ARG_WITH(eaccelerator-sessions, 61 54 [ --with-eaccelerator-sessions Include eaccelerator sessions],[ … … 70 63 ],[ 71 64 eaccelerator_content_caching=no 65 ]) 66 67 AC_ARG_WITH(eaccelerator-info, 68 [ --without-eaccelerator-info Do not compile the eAccelerator information functions],[ 69 eaccelerator_info=$withval 70 ],[ 71 eaccelerator_info=yes 72 72 ]) 73 73 … … 105 105 AC_DEFINE(HAVE_EACCELERATOR, 1, [Define if you like to use eAccelerator]) 106 106 107 AC_DEFINE(WITH_EACCELERATOR_INFO, 1, [Define to be able to get information about eAccelerator]) 108 107 109 AC_DEFINE_UNQUOTED(EA_USERID, $ea_userid, [The userid eAccelerator will be running under.]) 108 110 … … 122 124 AC_DEFINE(WITH_EACCELERATOR_SHM, 1, [Define if you like to use the eAccelerator functions to store keys in shared memory]) 123 125 fi 124 if test "$eaccelerator_ webui" = "yes"; then125 AC_DEFINE(WITH_EACCELERATOR_ WEBUI, 1, [Define if you like to use the eAccelerator WebUI])126 if test "$eaccelerator_info" = "yes"; then 127 AC_DEFINE(WITH_EACCELERATOR_INFO, 1, [Define if you want the information functions]) 126 128 fi 127 129 if test "$eaccelerator_sessions" = "yes"; then eaccelerator/trunk/eaccelerator.c
r176 r178 37 37 #include "zend_extensions.h" 38 38 39 #include "webui.h"40 39 #include "debug.h" 41 40 #include "shm.h" … … 45 44 #include "ea_store.h" 46 45 #include "ea_restore.h" 46 #include "ea_info.h" 47 #include "ea_dasm.h" 47 48 48 49 #include <sys/types.h> … … 904 905 *nreloads = 1; 905 906 EACCELERATOR_UNPROTECT(); 906 p = hash_find_mm(realname, buf, nreloads, 907 ((eaccelerator_shm_ttl > 0)?(compile_time + eaccelerator_shm_ttl):0)); 907 p = hash_find_mm(realname, buf, nreloads, ((eaccelerator_shm_ttl > 0)?(compile_time + eaccelerator_shm_ttl):0)); 908 908 if (p == NULL && !eaccelerator_scripts_shm_only) { 909 909 p = hash_find_file(realname, buf TSRMLS_CC); … … 1387 1387 */ 1388 1388 EAG(compiler) = 0; 1389 if (t != NULL && 1390 file_handle->opened_path != NULL && 1389 if (t != NULL && file_handle->opened_path != NULL && 1391 1390 #ifdef EACCELERATOR_USE_INODE 1392 1391 eaccelerator_ok_to_cache(file_handle->opened_path TSRMLS_CC)) { … … 1622 1621 php_info_print_table_header(2, "eAccelerator support", "enabled"); 1623 1622 php_info_print_table_row(2, "Version", EACCELERATOR_VERSION); 1624 php_info_print_table_row(2, "Caching Enabled", (EAG(enabled) && (eaccelerator_mm_instance != NULL) && eaccelerator_mm_instance->enabled)?"true":"false"); 1625 php_info_print_table_row(2, "Optimizer Enabled", (EAG(optimizer_enabled) && (eaccelerator_mm_instance != NULL) && eaccelerator_mm_instance->optimizer_enabled)?"true":"false"); 1623 php_info_print_table_row(2, "Caching Enabled", (EAG(enabled) && (eaccelerator_mm_instance != NULL) && 1624 eaccelerator_mm_instance->enabled)?"true":"false"); 1625 php_info_print_table_row(2, "Optimizer Enabled", (EAG(optimizer_enabled) && 1626 (eaccelerator_mm_instance != NULL) && eaccelerator_mm_instance->optimizer_enabled)?"true":"false"); 1626 1627 if (eaccelerator_mm_instance != NULL) { 1627 1628 size_t available; … … 1742 1743 #ifdef WITH_EACCELERATOR_CONTENT_CACHING 1743 1744 ZEND_INI_ENTRY("eaccelerator.content", "shm_and_disk", PHP_INI_SYSTEM, eaccelerator_OnUpdateContentCachePlace) 1745 #endif 1746 #ifdef WITH_EACCELERATOR_INFO 1747 STD_PHP_INI_ENTRY("eaccelerator.allowed_admin_path", "", PHP_INI_SYSTEM, OnUpdateString, allowed_admin_path, zend_eaccelerator_globals, eaccelerator_globals) 1744 1748 #endif 1745 1749 STD_PHP_INI_ENTRY("eaccelerator.cache_dir", "/tmp/eaccelerator", PHP_INI_SYSTEM, OnUpdateString, cache_dir, zend_eaccelerator_globals, eaccelerator_globals) … … 1918 1922 eaccelerator_globals->hostname[0] = '\000'; 1919 1923 eaccelerator_globals->in_request = 0; 1924 eaccelerator_globals->allowed_admin_path= NULL; 1920 1925 } 1921 1926 … … 2071 2076 zend_function tmp_func; 2072 2077 zend_class_entry tmp_class; 2073 2074 // Don't need this, as the context given by function argument.2075 // TSRMLS_FETCH();2076 2078 2077 2079 zend_hash_init_ex(&eaccelerator_global_function_table, 100, NULL, NULL, 1, 0); … … 2140 2142 PHP_RSHUTDOWN_FUNCTION(eaccelerator) 2141 2143 { 2142 if (eaccelerator_mm_instance == NULL) 2143 { 2144 if (eaccelerator_mm_instance == NULL) { 2144 2145 return SUCCESS; 2145 2146 } 2146 2147 #ifdef WITH_EACCELERATOR_CRASH_DETECTION 2147 2148 #ifdef SIGSEGV 2148 if (EAG(original_sigsegv_handler) != eaccelerator_crash_handler) 2149 { 2149 if (EAG(original_sigsegv_handler) != eaccelerator_crash_handler) { 2150 2150 signal(SIGSEGV, EAG(original_sigsegv_handler)); 2151 } 2152 else 2153 { 2151 } else { 2154 2152 signal(SIGSEGV, SIG_DFL); 2155 2153 } 2156 2154 #endif 2157 2155 #ifdef SIGFPE 2158 if (EAG(original_sigfpe_handler) != eaccelerator_crash_handler) 2159 { 2156 if (EAG(original_sigfpe_handler) != eaccelerator_crash_handler) { 2160 2157 signal(SIGFPE, EAG(original_sigfpe_handler)); 2161 } 2162 else 2163 { 2158 } else { 2164 2159 signal(SIGFPE, SIG_DFL); 2165 2160 } 2166 2161 #endif 2167 2162 #ifdef SIGBUS 2168 if (EAG(original_sigbus_handler) != eaccelerator_crash_handler) 2169 { 2163 if (EAG(original_sigbus_handler) != eaccelerator_crash_handler) { 2170 2164 signal(SIGBUS, EAG(original_sigbus_handler)); 2171 } 2172 else 2173 { 2165 } else { 2174 2166 signal(SIGBUS, SIG_DFL); 2175 2167 } 2176 2168 #endif 2177 2169 #ifdef SIGILL 2178 if (EAG(original_sigill_handler) != eaccelerator_crash_handler) 2179 { 2170 if (EAG(original_sigill_handler) != eaccelerator_crash_handler) { 2180 2171 signal(SIGILL, EAG(original_sigill_handler)); 2181 } 2182 else 2183 { 2172 } else { 2184 2173 signal(SIGILL, SIG_DFL); 2185 2174 } 2186 2175 #endif 2187 2176 #ifdef SIGABRT 2188 if (EAG(original_sigabrt_handler) != eaccelerator_crash_handler) 2189 { 2177 if (EAG(original_sigabrt_handler) != eaccelerator_crash_handler) { 2190 2178 signal(SIGABRT, EAG(original_sigabrt_handler)); 2191 } 2192 else 2193 { 2179 } else { 2194 2180 signal(SIGABRT, SIG_DFL); 2195 2181 } … … 2212 2198 2213 2199 function_entry eaccelerator_functions[] = { 2214 #ifdef WITH_EACCELERATOR_WEBUI2215 PHP_FE(eaccelerator, NULL)2216 #endif2217 2200 #ifdef WITH_EACCELERATOR_SHM 2218 2201 PHP_FE(eaccelerator_put, NULL) … … 2222 2205 PHP_FE(eaccelerator_lock, NULL) 2223 2206 PHP_FE(eaccelerator_unlock, NULL) 2207 #endif 2208 #ifdef WITH_EACCELERATOR_INFO 2209 PHP_FE(eaccelerator_caching, NULL) 2210 #ifdef WITH_EACCELERATOR_OPTIMIZER 2211 PHP_FE(eaccelerator_optimizer, NULL) 2212 #endif 2213 PHP_FE(eaccelerator_clear, NULL) 2214 PHP_FE(eaccelerator_clean, NULL) 2215 PHP_FE(eaccelerator_info, NULL) 2216 PHP_FE(eaccelerator_purge, NULL) 2217 PHP_FE(eaccelerator_cached_scripts, NULL) 2218 PHP_FE(eaccelerator_removed_scripts, NULL) 2219 PHP_FE(eaccelerator_list_keys, NULL) 2224 2220 #endif 2225 2221 #ifdef WITH_EACCELERATOR_ENCODER … … 2248 2244 PHP_FE(eaccelerator_cache_output, NULL) 2249 2245 PHP_FE(eaccelerator_cache_result, NULL) 2246 #endif 2247 #ifdef WITH_EACCELERATOR_DISASSEMBLER 2248 PHP_FE(eaccelerator_dasm_file, NULL) 2250 2249 #endif 2251 2250 #ifdef ZEND_ENGINE_2 eaccelerator/trunk/eaccelerator.h
r176 r178 304 304 unsigned int hv; /* hash value */ 305 305 long ttl; /* expiration time */ 306 long create; 306 307 int size; 307 308 zval value; /* value */ … … 460 461 char *name_space; 461 462 char *mem; 463 char *allowed_admin_path; 462 464 HashTable strings; 463 465 zend_class_entry *class_entry; eaccelerator/trunk/eaccelerator.ini
r141 r178 107 107 eaccelerator.content = "shm_and_disk" 108 108 109 ; eAccelerator can be managed through web interface script eaccelerator.php. So 110 ; you need to put this file on your web site. For security reasons it is 111 ; recommended to restrict the usage of this script by your local IP. 112 ; 113 ; To create the eAccelerator password type 114 ; 115 ; php -q eaccelerator_password.php 116 ; Changing password for eAccelerator Web Interface (eaccelerator.php) 117 ; 118 ; Enter admin name: admin 119 ; New admin password: eaccelerator 120 ; Retype new admin password: eaccelerator 109 ; The script paths that are allowed to get admin information and do admin 110 ; controls 111 eaccelerator.allowed_admin_path = "" 121 112 122 eaccelerator.admin.name="yourusername"123 eaccelerator.admin.password="yourpassword"eaccelerator/trunk/shm.c
r176 r178 68 68 /******************************************************************************/ 69 69 70 PHP_FUNCTION (eaccelerator_lock)70 PHP_FUNCTION(eaccelerator_lock) 71 71 { 72 72 char *key; 73 73 int key_len; 74 74 75 if (zend_parse_parameters (ZEND_NUM_ARGS ()TSRMLS_CC, "s", &key, &key_len) 76 == FAILURE) 75 if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &key, &key_len) == FAILURE) 77 76 return; 78 77 79 if (eaccelerator_lock (key, key_len TSRMLS_CC)) {78 if (eaccelerator_lock(key, key_len TSRMLS_CC)) { 80 79 RETURN_TRUE; 81 80 } else { … … 89 88 int key_len; 90 89 91 if (zend_parse_parameters (ZEND_NUM_ARGS ()TSRMLS_CC, "s", &key, &key_len) 92 == FAILURE) 90 if (zend_parse_parameters (ZEND_NUM_ARGS ()TSRMLS_CC, "s", &key, &key_len) == FAILURE) 93 91 return; 94 92 … … 108 106 long where = eaccelerator_keys_cache_place; 109 107 110 if (zend_parse_parameters (ZEND_NUM_ARGS ()TSRMLS_CC, "sz|ll", &key, 111 &key_len, &val, &ttl, &where) == FAILURE) 108 if (zend_parse_parameters (ZEND_NUM_ARGS ()TSRMLS_CC, "sz|ll", &key, &key_len, &val, &ttl, &where) == FAILURE) 112 109 return; 113 110 … … 125 122 long where = eaccelerator_keys_cache_place; 126 123 127 if (zend_parse_parameters (ZEND_NUM_ARGS ()TSRMLS_CC, 128 "s|l", &key, &key_len, &where) == FAILURE) 124 if (zend_parse_parameters (ZEND_NUM_ARGS ()TSRMLS_CC, "s|l", &key, &key_len, &where) == FAILURE) 129 125 return; 130 126 … … 142 138 long where = eaccelerator_keys_cache_place; 143 139 144 if (zend_parse_parameters (ZEND_NUM_ARGS ()TSRMLS_CC, 145 "s|l", &key, &key_len, &where) == FAILURE) 140 if (zend_parse_parameters (ZEND_NUM_ARGS ()TSRMLS_CC, "s|l", &key, &key_len, &where) == FAILURE) 146 141 return; 147 142 … … 161 156 RETURN_TRUE; 162 157 } 158 159 160 163 161 #endif /* WITH_EACCELERATOR_SHM */ 164 162 #endif /* HAVE_EACCELERATOR */ eaccelerator/trunk/shm.h
r176 r178 42 42 43 43 #endif /* WITH_EACCELERATOR_SHM */ 44 45 44 #endif /* INCLUDED_SHM_H */ eaccelerator/trunk/x86_spinlocks.h
r176 r178 66 66 } 67 67 } 68