Hello,
All of your point is acceptable for me, too. Of cource I do not
think APC has something to do with realpath calls, and as I wrote in
another mail, APC is just a way to make skipping realpath() calls
more easy (to be exact, it's the way to suppress realpath() only once
for each script through all the process. So this patch can
identify the same script in different path).
I tried some other ways to skip realpath (like realpath caching), and
then concluded that my previous patch was the simplest, smallest, and
most effective one.
Anyway, I think Andi's realpath cache which mentioned in another mail
will be the great help of most of people, and I'm happy if it'll be
committed in php-src (of course I'm happier if I can commit my
patch, too:), but if you want to enhance your PHP more (especially in
PHP 4, which will not have realpath cache), and if you could
arbitrarily build your PHP, I believe my patch should be the great
help, too.
Finally, an attacehd patch will prevent your crash, but if you already
turned all the realpath calls off, my patch will not affect any
performance...
Masaki Fujimoto
The Message From Rasmus Lerdorf:
> On Fri, 7 May 2004, BUSTARRET, Jean-Francois wrote:
> > Let's get rid of this useless (when using a cache) realpath call, without having
> > to migrate to PHP5 !
>
> Well, the realpath call's usefulness doesn't have anything to do with the
> cache. It is there to provide a canonicalized absolute pathname to be
> stored in the included_files list and on every include another realpath is
> done to check against this list. This means that if the same file is
> included via different paths, the include_once/require_once will still
> catch that fact.
>
> Now, I do agree with you that the cost for this convenience is way too
> high which is why I turn this off for my use and tell people they get what
> they deserve if they include the same file via different paths. Of
> course, turning this off also messes up any open_basedir checks as it
> becomes trivial to work around an open_basedir restriction with a symlink
> or some creative path walking.
>
> I did try your patch and it crashed my build. Granted, my tree is quite
> hacked up and doesn't ever call realpath, but still. Haven't had time to
> track down exactly why it caused problems.
>
> -Rasmus
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
diff -ru APC-2.0.3.bak/apc_main.c APC-2.0.3/apc_main.c
--- APC-2.0.3.bak/apc_main.c Fri Mar 26 03:53:43 2004
+++ APC-2.0.3/apc_main.c Thu May 6 20:10:12 2004
@@ -166,6 +166,11 @@
/* search for the file in the cache */
cache_entry = apc_cache_find(APCG(cache), key);
if (cache_entry != NULL) {
+#if DELAYED_FOPEN
+ if (h->opened_path == NULL && cache_entry->filename) {
+ h->opened_path = estrdup(cache_entry->filename);
+ }
+#endif /* DELAYED_FOPEN */
zend_llist_add_element(&CG(open_files), h); /* XXX kludge */
apc_stack_push(APCG(cache_stack), cache_entry);
return cached_compile(TSRMLS_C);
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php