#198 closed enhancement (fixed)
xcache with streams on ZEND_ENGINE_2
| Reported by: | lang@… | Owned by: | moo |
|---|---|---|---|
| Priority: | major | Milestone: | 3.0.0 |
| Component: | cacher | Version: | 1.3.0 |
| Keywords: | Cc: | ||
| Application: | PHP Version: | ||
| Other Exts: | SAPI: | Irrelevant | |
| Probability: | Blocked By: | ||
| Blocking: |
Description (last modified by moo)
Hi xcache developers,
this patch permits to process streams from xcache on ZEND_ENGINE_2. It is very helpfully when a php module use streams.
-
xcache-1.2.
diff -u -r -N xcache-1.2.2/xcache.c xcache-1.2.2-patch/xcache.c
old new 727 727 php = xce->data.php; 728 728 729 729 if (XG(stat)) { 730 731 #ifdef ZEND_ENGINE_2 732 php_stream_statbuf ssb; 733 php_stream_wrapper *wrapper = NULL; 734 char *path_for_open = NULL; 735 736 wrapper = php_stream_locate_url_wrapper(filename, &path_for_open, 0 TSRMLS_CC); 737 if ((wrapper) && (wrapper->wops) && (wrapper->wops->url_stat) && 738 (wrapper != &php_plain_files_wrapper) && 739 (SUCCESS == wrapper->wops->url_stat(wrapper, path_for_open, PHP_STREAM_URL_STAT_QUIET, &ssb, NULL TSRMLS_CC))) { 740 pbuf = &ssb.sb; 741 goto stat_done; 742 } 743 #endif 744 730 745 if (strcmp(SG(request_info).path_translated, filename) == 0) { 731 746 /* sapi has already done this stat() for us */ 732 747 pbuf = sapi_get_stat(TSRMLS_C);
Attachments (5)
Change History (19)
comment:1 Changed 5 years ago by moo
- Description modified (diff)
- Status changed from new to accepted
comment:2 Changed 5 years ago by judas_iscariote
comment:3 in reply to: ↑ description Changed 4 years ago by hlang
- Milestone changed from 1.3.1 to 1.4.0
- Version changed from 1.2.2 to 1.3.0
Hi xcache developers, this is the new patch of the xcache version 1.3.0 for the feature to cache streams by xcache.
I think still always this is very helpfully.
-
xcache-1.3.
old new 800 800 return FAILURE; 801 801 } 802 802 803 /* 803 804 if (strstr(filename, "://") != NULL) { 804 805 return FAILURE; 805 806 } 807 */ 806 808 807 809 php = xce->data.php; 808 810 809 811 if (XG(stat)) { 812 813 #ifdef ZEND_ENGINE_2 814 php_stream_statbuf ssb; 815 php_stream_wrapper *wrapper = NULL; 816 char *path_for_open = NULL; 817 818 wrapper = php_stream_locate_url_wrapper(filename, &path_for_open, 0 TSRMLS_CC); 819 if ((wrapper) && (wrapper->wops) && (wrapper->wops->url_stat) && 820 (wrapper != &php_plain_files_wrapper) && 821 (SUCCESS == wrapper->wops->url_stat(wrapper, path_for_open, PHP_STREAM_URL_STAT_QUIET, &ssb, NULL TSRMLS_CC))) { 822 pbuf = &ssb.sb; 823 goto stat_done; 824 } 825 #endif 826 810 827 if (strcmp(SG(request_info).path_translated, filename) == 0) { 811 828 /* sapi has already done this stat() for us */ 812 829 pbuf = sapi_get_stat(TSRMLS_C);
comment:4 Changed 11 months ago by moo
- Status changed from accepted to new
comment:5 Changed 11 months ago by moo
- Resolution set to fixed
- Status changed from new to closed
already in 2.0. reopen bug if there's problem with streams
comment:6 Changed 11 months ago by moo
- Milestone changed from 3.0.0 to 2.0.0
comment:7 Changed 11 months ago by hlang
- Resolution fixed deleted
- Status changed from closed to reopened
hello,
php modul streams does always not work with xcache.
the function xc_compile_file() excludes the posibility.
xcache could also accelerate php modul streams.
i attached the patch to cache php modul streams in xcache version 2.0.x
comment:8 Changed 11 months ago by moo
please also provide your test case
comment:9 Changed 11 months ago by hlang
the test case is attached as phpmodulstream.tgz
# to create phpmodulstream.so
phpize
./configure
make
# find the php modul phpmodulstream.so in subdir modules
# add the phpmodulstream.so to your php configuration
# in extension path
extension=phpmodulstream.so
# or absolute path
extension=/<your>/<current>/<make>/<path>/modules/phpmodulstream.so
# restart apache
# correct installation shows part phpmodulstream in phpinfo()
# move test.php to htdocs and call it from browser
# access for stream is phpmodulstream://whatever...
# example
require_once 'phpmodulstream://blafasel.php';
# xcache work correct when reload from test.php shown always same time
comment:10 Changed 11 months ago by moo
- Milestone changed from 2.0.0 to 3.0.0
comment:11 Changed 11 months ago by hlang
i attach the patch for xcache-trunc
comment:12 Changed 11 months ago by moo
thanks. The logic of that part in XCache need to be rechecked for both optimize and feature
comment:13 Changed 10 months ago by moo
- Resolution set to fixed
- Status changed from reopened to closed
the patch is rewrite carefully, committed as [1140] for trunk (3.0.0-dev). please try it out
i thought the test case was simply *.php code. i wonder if user defined stream protocol can be include()'d and cached correctly. i'd like there be some *.phpt code for this under xcache/tests/
thanks for your time making patch. but XCache dev has stopped adding features to 2.0.x 1.3.x 1.2.x. not new release for 1.3.x 1.2.x critical security problem
comment:14 Changed 10 months ago by hlang
i'm so happy.
i test your commit and it run perfect.
we use this stream access over 10 years and only xcache can cache streams really stable.
thank you for that implemention.


This patch looks fine, moo what you think ?