Bug #52312 [Com]: PHP lstat problem
Edit report at http://bugs.php.net/bug.php?id=52312edit=1 ID: 52312 Comment by: v dot damore at gmail dot com Reported by: v dot damore at gmail dot com Summary: PHP lstat problem Status: Feedback Type: Bug Package: Safe Mode/open_basedir Operating System: Linux PHP Version: 5.2.13 New Comment: Looking at source code main/main.c of 5.2.13 I can see: 1292: /* Disable realpath cache if safe_mode or open_basedir are set */ if (PG(safe_mode) || (PG(open_basedir) *PG(open_basedir))) { CWDG(realpath_cache_size_limit) = 0; } 1769: /* Disable realpath cache if safe_mode or open_basedir are set */ if (PG(safe_mode) || (PG(open_basedir) *PG(open_basedir))) { CWDG(realpath_cache_size_limit) = 0; } So realpath cache is definitely disabled in case of safe_mode or open_basedir. This dramatically reduce performance of PHP Engine and this behavior can bring a server to its knees. Especially because there is a lack of documentation! Can you explain why this choose? Must I continue debugging PHP engine in order to understand what's happening? Previous Comments: [2010-07-13 01:52:37] v dot damore at gmail dot com I found where the problem is, this behavior is not a bug. Looking at main/main.c I found following lines: 1416: /* Disable realpath cache if safe_mode or open_basedir are set */ if (PG(safe_mode) || (PG(open_basedir) *PG(open_basedir))) { CWDG(realpath_cache_size_limit) = 0; } 1978: /* Disable realpath cache if safe_mode or open_basedir are set */ if (PG(safe_mode) || (PG(open_basedir) *PG(open_basedir))) { CWDG(realpath_cache_size_limit) = 0; } Could you explain why if safe_mode or open_basedir are set realpath cache is disabled? [2010-07-13 01:38:26] v dot damore at gmail dot com There is a interesting update, I have found CWDG define so now we have: (gdb) print cwd_globals.realpath_cache_size_limit $3 = 0 Probably you should check why realpath_cache_size_limit is equal to 0 [2010-07-13 01:30:24] v dot damore at gmail dot com After having set breakpoint tsrm_realpath_r and I have execute step by step debug. I think is interesting that after execution tsrm_virtual_cwd.c of line 681 execution continue on line 890. gdb) break tsrm_realpath_r Breakpoint 1 at 0x2b0b3c9f2702: file /usr/local/sitipersonali/sitipersonali01/NSP_SERVICE/strillo/sources/php-5.3.2/TSRM/tsrm_virtual_cwd.c, line 611. (gdb) continue Continuing. Breakpoint 1, tsrm_realpath_r (path=0x7fffddfb32b0 /usr/local/myspace/webspace/httpdocs/test.php, start=1, len=45, ll=0x7fffddfb32ac, t=0x7fffddfb32a0, use_realpath=2, is_dir=0, link_is_dir=0x0) at /usr/local/sitipersonali/sitipersonali01/NSP_SERVICE/strillo/sources/php-5.3.2/TSRM/tsrm_virtual_cwd.c:611 611 int directory = 0; (gdb) step 624 if (len = start) { (gdb) step 628 i = len; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 633 if (i == len || (gdb) step 639 } else if (i == len - 2 path[i] == '.' path[i+1] == '.') { (gdb) step 677 path[len] = 0; (gdb) step 679 save = (use_realpath != CWD_EXPAND); (gdb) step 681 if (start save CWDG(realpath_cache_size_limit)) { (gdb) watch save Hardware watchpoint 2: save (gdb) print save $1 = 1 (gdb) print start $2 = 1 (gdb) print realpath_cache_size_limit No symbol
Bug #52312 [Com]: PHP lstat problem
Edit report at http://bugs.php.net/bug.php?id=52312edit=1 ID: 52312 Comment by: v dot damore at gmail dot com Reported by: v dot damore at gmail dot com Summary: PHP lstat problem Status: Analyzed Type: Bug Package: Safe Mode/open_basedir Operating System: Linux PHP Version: 5.2.13 New Comment: If you take a look at debugging done in http://damore.xoom.it/apache-2.2_php-5.3.2_break-lstat.txt, you can see that tsrm_realpath_r is called in 2 different place: - First during phar_find_in_include_path function - Second during php_check_specific_open_basedir function. * During php_check_specific_open_basedir, traverse entire path at least three times, so i means 3 call to tsrm_realpath_r. I don't discuss the need to traverse entire path, but only one time. There should be a better way to implement such code, I'll try to write a patch if there is someone that want help me looking what I'm writing. Previous Comments: [2010-07-13 15:23:33] paj...@php.net The reason was due to a security flaw involving symbolic links and realpath cache. It allowed to bypass open_basedir when a path was cached. The cleanest way to fix it was to disable the realpath cache when open_basedir/safemode are set. Thanks Johannes to remind us about this change. [2010-07-13 11:01:23] v dot damore at gmail dot com Looking at source code main/main.c of 5.2.13 I can see: 1292: /* Disable realpath cache if safe_mode or open_basedir are set */ if (PG(safe_mode) || (PG(open_basedir) *PG(open_basedir))) { CWDG(realpath_cache_size_limit) = 0; } 1769: /* Disable realpath cache if safe_mode or open_basedir are set */ if (PG(safe_mode) || (PG(open_basedir) *PG(open_basedir))) { CWDG(realpath_cache_size_limit) = 0; } So realpath cache is definitely disabled in case of safe_mode or open_basedir. This dramatically reduce performance of PHP Engine and this behavior can bring a server to its knees. Especially because there is a lack of documentation! Can you explain why this choose? Must I continue debugging PHP engine in order to understand what's happening? [2010-07-13 01:52:37] v dot damore at gmail dot com I found where the problem is, this behavior is not a bug. Looking at main/main.c I found following lines: 1416: /* Disable realpath cache if safe_mode or open_basedir are set */ if (PG(safe_mode) || (PG(open_basedir) *PG(open_basedir))) { CWDG(realpath_cache_size_limit) = 0; } 1978: /* Disable realpath cache if safe_mode or open_basedir are set */ if (PG(safe_mode) || (PG(open_basedir) *PG(open_basedir))) { CWDG(realpath_cache_size_limit) = 0; } Could you explain why if safe_mode or open_basedir are set realpath cache is disabled? [2010-07-13 01:38:26] v dot damore at gmail dot com There is a interesting update, I have found CWDG define so now we have: (gdb) print cwd_globals.realpath_cache_size_limit $3 = 0 Probably you should check why realpath_cache_size_limit is equal to 0 [2010-07-13 01:30:24] v dot damore at gmail dot com After having set breakpoint tsrm_realpath_r and I have execute step by step debug. I think is interesting that after execution tsrm_virtual_cwd.c of line 681 execution continue on line 890. gdb) break tsrm_realpath_r Breakpoint 1 at 0x2b0b3c9f2702: file /usr/local/sitipersonali/sitipersonali01/NSP_SERVICE/strillo/sources/php-5.3.2/TSRM/tsrm_virtual_cwd.c, line 611. (gdb) continue Continuing. Breakpoint 1, tsrm_realpath_r (path=0x7fffddfb32b0 /usr/local/myspace/webspace/httpdocs/test.php, start=1, len=45, ll=0x7fffddfb32ac, t=0x7fffddfb32a0, use_realpath=2, is_dir=0, link_is_dir=0x0) at /usr/local/sitipersonali/sitipersonali01/NSP_SERVICE/strillo/sources/php-5.3.2/TSRM/tsrm_virtual_cwd.c:611 611 int directory = 0; (gdb) step 624 if (len = start) { (gdb) step 628 i = len; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630
Bug #52312 [Com]: PHP lstat problem
Edit report at http://bugs.php.net/bug.php?id=52312edit=1 ID: 52312 Comment by: v dot damore at gmail dot com Reported by: v dot damore at gmail dot com Summary: PHP lstat problem Status: Analyzed Type: Bug Package: Safe Mode/open_basedir Operating System: Linux PHP Version: 5.2.13 New Comment: Please pay attention correct URL for debugging info is http://damore.xoom.it/apache-2.2_php-5.3.2_break-lstat.txt Previous Comments: [2010-07-13 21:04:24] v dot damore at gmail dot com If you take a look at debugging done in http://damore.xoom.it/apache-2.2_php-5.3.2_break-lstat.txt, you can see that tsrm_realpath_r is called in 2 different place: - First during phar_find_in_include_path function - Second during php_check_specific_open_basedir function. * During php_check_specific_open_basedir, traverse entire path at least three times, so i means 3 call to tsrm_realpath_r. I don't discuss the need to traverse entire path, but only one time. There should be a better way to implement such code, I'll try to write a patch if there is someone that want help me looking what I'm writing. [2010-07-13 15:23:33] paj...@php.net The reason was due to a security flaw involving symbolic links and realpath cache. It allowed to bypass open_basedir when a path was cached. The cleanest way to fix it was to disable the realpath cache when open_basedir/safemode are set. Thanks Johannes to remind us about this change. [2010-07-13 11:01:23] v dot damore at gmail dot com Looking at source code main/main.c of 5.2.13 I can see: 1292: /* Disable realpath cache if safe_mode or open_basedir are set */ if (PG(safe_mode) || (PG(open_basedir) *PG(open_basedir))) { CWDG(realpath_cache_size_limit) = 0; } 1769: /* Disable realpath cache if safe_mode or open_basedir are set */ if (PG(safe_mode) || (PG(open_basedir) *PG(open_basedir))) { CWDG(realpath_cache_size_limit) = 0; } So realpath cache is definitely disabled in case of safe_mode or open_basedir. This dramatically reduce performance of PHP Engine and this behavior can bring a server to its knees. Especially because there is a lack of documentation! Can you explain why this choose? Must I continue debugging PHP engine in order to understand what's happening? [2010-07-13 01:52:37] v dot damore at gmail dot com I found where the problem is, this behavior is not a bug. Looking at main/main.c I found following lines: 1416: /* Disable realpath cache if safe_mode or open_basedir are set */ if (PG(safe_mode) || (PG(open_basedir) *PG(open_basedir))) { CWDG(realpath_cache_size_limit) = 0; } 1978: /* Disable realpath cache if safe_mode or open_basedir are set */ if (PG(safe_mode) || (PG(open_basedir) *PG(open_basedir))) { CWDG(realpath_cache_size_limit) = 0; } Could you explain why if safe_mode or open_basedir are set realpath cache is disabled? [2010-07-13 01:38:26] v dot damore at gmail dot com There is a interesting update, I have found CWDG define so now we have: (gdb) print cwd_globals.realpath_cache_size_limit $3 = 0 Probably you should check why realpath_cache_size_limit is equal to 0 The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/bug.php?id=52312 -- Edit this bug report at http://bugs.php.net/bug.php?id=52312edit=1
Bug #52312 [Com]: PHP lstat problem
Edit report at http://bugs.php.net/bug.php?id=52312edit=1 ID: 52312 Comment by: v dot damore at gmail dot com Reported by: v dot damore at gmail dot com Summary: PHP lstat problem Status: Bogus Type: Bug Package: Safe Mode/open_basedir Operating System: Linux PHP Version: 5.2.13 New Comment: Thanks for your explanation, I followed your suggestions and there is a performance improvement in submitted case. Anyway your suggestions are not applicable in all cases. Please consider this problem from my point of view: in a production environment of a big web hosting provider. In this real case there are many thousands of users that can freely write their own PHP code, there also are hundreds of thousands of pages that cannot be cached. Please consider also that what happens when Google spiders come to crawl all pages. Previous Comments: [2010-07-12 13:49:38] ras...@php.net There is a realpath cache that gets populated, so you need to warm up the cache and not strace the first request. You shouldn't care that the first request to the server takes a few more stats. The real test is whether subsequent requests are slow. If you are seeing excessive stats with the caches warmed up, then you need to investigate the size of your realpath cache in your php.ini and possibly increase it. This part has been made more efficient in PHP 5.3. It would also be a good idea to turn off AllowOverride in your Apache config to get rid of the .htaccess stats if you are concerned about the number of stat calls. So, do this. Start Apache in non-forking mode by running it with -X Then hit a simple hello_world.php script a few times. Don't use phpinfo because it does a number of evil things on its own. After hitting your hello world script a couple of times, attach strace to the Apache process (strace -p pid) and then hit the server again once. At this point you should not see any extra stats. [2010-07-12 10:03:42] v dot damore at gmail dot com Description: PHP lstat full pathname many times (at least 4) before read the file is looking for. This behavior appear when in apache httpd configuration is specified PHP_ADMIN_VALUE open_basedir or safe_mode is On. Test script: --- To reproduce the problem please create a page phpinfo.php: ? phpinfo() ?. I have httpd.2.2.15, PHP 5.2.13. [r...@svilpar4 ~]# /usr/local/apache2/bin/httpd -V Server version: Apache/2.2.15 (Unix) Server built: Jul 9 2010 17:30:06 Server's Module Magic Number: 20051115:24 Server loaded: APR 1.2.7, APR-Util 1.2.7 Compiled using: APR 1.2.7, APR-Util 1.2.7 Architecture: 64-bit Server MPM: Prefork threaded: no forked: yes (variable process count) Server compiled with -D APACHE_MPM_DIR=server/mpm/prefork -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) -D APR_USE_SYSVSEM_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D DYNAMIC_MODULE_LIMIT=128 -D HTTPD_ROOT=/usr/local/apache2 -D SUEXEC_BIN=/usr/local/apache2/bin/suexec -D DEFAULT_PIDLOG=logs/httpd.pid -D DEFAULT_SCOREBOARD=logs/apache_runtime_status -D DEFAULT_LOCKFILE=logs/accept.lock -D DEFAULT_ERRORLOG=logs/error_log -D AP_TYPES_CONFIG_FILE=conf/mime.types -D SERVER_CONFIG_FILE=conf/httpd.conf [r...@svilpar4 ~]# /usr/local/php5.2.13/bin/php -v PHP 5.2.13 (cli) (built: Jul 1 2010 16:02:03) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies Now we specify PHP_ADMIN_VALUE open_basedir/strong in Virtual host configuration: Directory /usr/local/myspace/webspace/httpdocs PHP_ADMIN_VALUE open_basedir /usr/local/myspace/webspace /Directory VirtualHost *:80 ServerName damorealt.xoom.it DocumentRoot /usr/local/myspace/webspace/httpdocs CustomLog /var/log/httpd/damorealt/access_log combined ErrorLog /var/log/httpd/damorealt/error_log /VirtualHost Stop start apache httpd, strace -f all httpd instances and then call page http://damorealt.xoom.it/phpinfo.php, so we can reproduce behavior Expected result: If PHP_ADMIN_VALUE open_basedir /usr/local/myspace/webspace is removed and safe_mode is Off : 226235 accept(3, {sa_family=AF_INET, sin_port=htons(59366), sin_addr=inet_addr(212.48.14.186)}, [17179869200]) = 15 26235 getsockname(15, {sa_family=AF_INET, sin_port=htons(80), sin_addr=inet_addr(151.99.197.198)}, [17179869200]) = 0 26235 fcntl(15, F_GETFL)= 0x2 (flags O_RDWR) 26235 fcntl(15, F_SETFL, O_RDWR|O_NONBLOCK) = 0 26235 read(15, GET /phpinfo.php HTTP/1.0\r\nUser-...,
Bug #52312 [Com]: PHP lstat problem
Edit report at http://bugs.php.net/bug.php?id=52312edit=1 ID: 52312 Comment by: v dot damore at gmail dot com Reported by: v dot damore at gmail dot com Summary: PHP lstat problem Status: Bogus Type: Bug Package: Safe Mode/open_basedir Operating System: Linux PHP Version: 5.2.13 New Comment: We already tuned cache size to following values: realpath_cache_size=1024k realpath_cache_ttl=7200 Can we increase cache size to: realpath_cache_size=40960k realpath_cache_ttl=72000 Do you know if memory_limit is affected by realpath_cache_size increase? Actually our memory limit is set to: memory_limit = 96M But biggest problem we have at moment is when search engines spiders come to crawling all platform. In this case all existing pages are crawled by spiders. Can you suggest us a workaround? Previous Comments: [2010-07-12 14:23:59] paj...@php.net That's why the setting realpath_cache_size and TTL exist. They allow you to fine tune this cache to fit your needs. On a shared host you will certainly increase the default value. [2010-07-12 14:16:59] v dot damore at gmail dot com Thanks for your explanation, I followed your suggestions and there is a performance improvement in submitted case. Anyway your suggestions are not applicable in all cases. Please consider this problem from my point of view: in a production environment of a big web hosting provider. In this real case there are many thousands of users that can freely write their own PHP code, there also are hundreds of thousands of pages that cannot be cached. Please consider also that what happens when Google spiders come to crawl all pages. [2010-07-12 13:49:38] ras...@php.net There is a realpath cache that gets populated, so you need to warm up the cache and not strace the first request. You shouldn't care that the first request to the server takes a few more stats. The real test is whether subsequent requests are slow. If you are seeing excessive stats with the caches warmed up, then you need to investigate the size of your realpath cache in your php.ini and possibly increase it. This part has been made more efficient in PHP 5.3. It would also be a good idea to turn off AllowOverride in your Apache config to get rid of the .htaccess stats if you are concerned about the number of stat calls. So, do this. Start Apache in non-forking mode by running it with -X Then hit a simple hello_world.php script a few times. Don't use phpinfo because it does a number of evil things on its own. After hitting your hello world script a couple of times, attach strace to the Apache process (strace -p pid) and then hit the server again once. At this point you should not see any extra stats. [2010-07-12 10:03:42] v dot damore at gmail dot com Description: PHP lstat full pathname many times (at least 4) before read the file is looking for. This behavior appear when in apache httpd configuration is specified PHP_ADMIN_VALUE open_basedir or safe_mode is On. Test script: --- To reproduce the problem please create a page phpinfo.php: ? phpinfo() ?. I have httpd.2.2.15, PHP 5.2.13. [r...@svilpar4 ~]# /usr/local/apache2/bin/httpd -V Server version: Apache/2.2.15 (Unix) Server built: Jul 9 2010 17:30:06 Server's Module Magic Number: 20051115:24 Server loaded: APR 1.2.7, APR-Util 1.2.7 Compiled using: APR 1.2.7, APR-Util 1.2.7 Architecture: 64-bit Server MPM: Prefork threaded: no forked: yes (variable process count) Server compiled with -D APACHE_MPM_DIR=server/mpm/prefork -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) -D APR_USE_SYSVSEM_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D DYNAMIC_MODULE_LIMIT=128 -D HTTPD_ROOT=/usr/local/apache2 -D SUEXEC_BIN=/usr/local/apache2/bin/suexec -D DEFAULT_PIDLOG=logs/httpd.pid -D DEFAULT_SCOREBOARD=logs/apache_runtime_status -D DEFAULT_LOCKFILE=logs/accept.lock -D DEFAULT_ERRORLOG=logs/error_log -D AP_TYPES_CONFIG_FILE=conf/mime.types -D SERVER_CONFIG_FILE=conf/httpd.conf [r...@svilpar4 ~]# /usr/local/php5.2.13/bin/php -v PHP 5.2.13 (cli) (built: Jul 1 2010 16:02:03) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies Now we specify PHP_ADMIN_VALUE open_basedir/strong in Virtual host configuration: Directory /usr/local/myspace/webspace/httpdocs PHP_ADMIN_VALUE open_basedir
Bug #52312 [Com]: PHP lstat problem
Edit report at http://bugs.php.net/bug.php?id=52312edit=1 ID: 52312 Comment by: v dot damore at gmail dot com Reported by: v dot damore at gmail dot com Summary: PHP lstat problem Status: Bogus Type: Bug Package: Safe Mode/open_basedir Operating System: Linux PHP Version: 5.2.13 New Comment: I must also to notify that looking at our production servers in some cases PHP engine tries up to 8 times before read the file. Can you explain why PHP engine have this behavior? There is any way to remove/change this behavior in PHP engine? Previous Comments: [2010-07-12 14:43:43] v dot damore at gmail dot com We already tuned cache size to following values: realpath_cache_size=1024k realpath_cache_ttl=7200 Can we increase cache size to: realpath_cache_size=40960k realpath_cache_ttl=72000 Do you know if memory_limit is affected by realpath_cache_size increase? Actually our memory limit is set to: memory_limit = 96M But biggest problem we have at moment is when search engines spiders come to crawling all platform. In this case all existing pages are crawled by spiders. Can you suggest us a workaround? [2010-07-12 14:23:59] paj...@php.net That's why the setting realpath_cache_size and TTL exist. They allow you to fine tune this cache to fit your needs. On a shared host you will certainly increase the default value. [2010-07-12 14:16:59] v dot damore at gmail dot com Thanks for your explanation, I followed your suggestions and there is a performance improvement in submitted case. Anyway your suggestions are not applicable in all cases. Please consider this problem from my point of view: in a production environment of a big web hosting provider. In this real case there are many thousands of users that can freely write their own PHP code, there also are hundreds of thousands of pages that cannot be cached. Please consider also that what happens when Google spiders come to crawl all pages. [2010-07-12 13:49:38] ras...@php.net There is a realpath cache that gets populated, so you need to warm up the cache and not strace the first request. You shouldn't care that the first request to the server takes a few more stats. The real test is whether subsequent requests are slow. If you are seeing excessive stats with the caches warmed up, then you need to investigate the size of your realpath cache in your php.ini and possibly increase it. This part has been made more efficient in PHP 5.3. It would also be a good idea to turn off AllowOverride in your Apache config to get rid of the .htaccess stats if you are concerned about the number of stat calls. So, do this. Start Apache in non-forking mode by running it with -X Then hit a simple hello_world.php script a few times. Don't use phpinfo because it does a number of evil things on its own. After hitting your hello world script a couple of times, attach strace to the Apache process (strace -p pid) and then hit the server again once. At this point you should not see any extra stats. [2010-07-12 10:03:42] v dot damore at gmail dot com Description: PHP lstat full pathname many times (at least 4) before read the file is looking for. This behavior appear when in apache httpd configuration is specified PHP_ADMIN_VALUE open_basedir or safe_mode is On. Test script: --- To reproduce the problem please create a page phpinfo.php: ? phpinfo() ?. I have httpd.2.2.15, PHP 5.2.13. [r...@svilpar4 ~]# /usr/local/apache2/bin/httpd -V Server version: Apache/2.2.15 (Unix) Server built: Jul 9 2010 17:30:06 Server's Module Magic Number: 20051115:24 Server loaded: APR 1.2.7, APR-Util 1.2.7 Compiled using: APR 1.2.7, APR-Util 1.2.7 Architecture: 64-bit Server MPM: Prefork threaded: no forked: yes (variable process count) Server compiled with -D APACHE_MPM_DIR=server/mpm/prefork -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) -D APR_USE_SYSVSEM_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D DYNAMIC_MODULE_LIMIT=128 -D HTTPD_ROOT=/usr/local/apache2 -D SUEXEC_BIN=/usr/local/apache2/bin/suexec -D DEFAULT_PIDLOG=logs/httpd.pid -D DEFAULT_SCOREBOARD=logs/apache_runtime_status -D DEFAULT_LOCKFILE=logs/accept.lock -D DEFAULT_ERRORLOG=logs/error_log -D AP_TYPES_CONFIG_FILE=conf/mime.types -D SERVER_CONFIG_FILE=conf/httpd.conf [r...@svilpar4 ~]#
Bug #52312 [Com]: PHP lstat problem
Edit report at http://bugs.php.net/bug.php?id=52312edit=1 ID: 52312 Comment by: v dot damore at gmail dot com Reported by: v dot damore at gmail dot com Summary: PHP lstat problem Status: Bogus Type: Bug Package: Safe Mode/open_basedir Operating System: Linux PHP Version: 5.2.13 New Comment: @pajoye; as is described in Actual result part of this bug, first time PHP engine check filepath there is a full scan of all directories at least 4 times before cache the result, this behavior anyway cannot scale in a so large environment. @rasmus: this is very interesting, I can consider upgrade to 5.3 in order to avoid this behavior. I know this is an extrema ratio: may I disable symlinks support from PHP engine in order to avoid this behavior? Is there an answer regarding the increase of realpath_cache_size realpath_cache_ttl? Previous Comments: [2010-07-12 15:36:10] ras...@php.net And like I said, we have made this more efficient in PHP 5.3 because we now cache the partial paths separately. You should see a performance improvement going to 5.3. [2010-07-12 15:32:33] paj...@php.net Again, it does it once and only once per path. When it does it, it checks each element of a path (and cache each of them too). [2010-07-12 14:59:36] v dot damore at gmail dot com I must also to notify that looking at our production servers in some cases PHP engine tries up to 8 times before read the file. Can you explain why PHP engine have this behavior? There is any way to remove/change this behavior in PHP engine? [2010-07-12 14:43:43] v dot damore at gmail dot com We already tuned cache size to following values: realpath_cache_size=1024k realpath_cache_ttl=7200 Can we increase cache size to: realpath_cache_size=40960k realpath_cache_ttl=72000 Do you know if memory_limit is affected by realpath_cache_size increase? Actually our memory limit is set to: memory_limit = 96M But biggest problem we have at moment is when search engines spiders come to crawling all platform. In this case all existing pages are crawled by spiders. Can you suggest us a workaround? [2010-07-12 14:23:59] paj...@php.net That's why the setting realpath_cache_size and TTL exist. They allow you to fine tune this cache to fit your needs. On a shared host you will certainly increase the default value. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/bug.php?id=52312 -- Edit this bug report at http://bugs.php.net/bug.php?id=52312edit=1
Bug #52312 [Com]: PHP lstat problem
Edit report at http://bugs.php.net/bug.php?id=52312edit=1 ID: 52312 Comment by: v dot damore at gmail dot com Reported by: v dot damore at gmail dot com Summary: PHP lstat problem Status: Bogus Type: Bug Package: Safe Mode/open_basedir Operating System: Linux PHP Version: 5.2.13 New Comment: The real problem is that such full scan are repeated more then once: 25933 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local/myspace/webspace/httpdocs, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local/myspace/webspace/httpdocs/phpinfo.php, {st_mode=S_IFREG|0644, st_size=16, ...}) = 0 First check 25933 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local/myspace/webspace/httpdocs, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local/myspace/webspace/httpdocs/phpinfo.php, {st_mode=S_IFREG|0644, st_size=16, ...}) = 0 Second check 25933 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 Third check (incomplete) 25933 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local/myspace/webspace/httpdocs, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local/myspace/webspace/httpdocs/phpinfo.php, {st_mode=S_IFREG|0644, st_size=16, ...}) = 0 Final check and then read the file. 25933 open(/usr/local/myspace/webspace/httpdocs/phpinfo.php, O_RDONLY) = 16 25933 fstat(16, {st_mode=S_IFREG|0644, st_size=16, ...}) = 0 25933 read(16, ? phpinfo() ?\n, 8192) = 16 25933 read(16, , 8192)= 0 25933 read(16, , 8192)= 0 25933 close(16) = 0 Previous Comments: [2010-07-12 16:35:46] paj...@php.net The scan of each element of the paths happen anyway, whether the paths contain symlinks or not. Check the code TSRM/ for a deeper explanation. [2010-07-12 15:57:54] v dot damore at gmail dot com @pajoye; as is described in Actual result part of this bug, first time PHP engine check filepath there is a full scan of all directories at least 4 times before cache the result, this behavior anyway cannot scale in a so large environment. @rasmus: this is very interesting, I can consider upgrade to 5.3 in order to avoid this behavior. I know this is an extrema ratio: may I disable symlinks support from PHP engine in order to avoid this behavior? Is there an answer regarding the increase of realpath_cache_size realpath_cache_ttl? [2010-07-12 15:36:10] ras...@php.net And like I said, we have made this more efficient in PHP 5.3 because we now cache the partial paths separately. You should see a performance improvement going to 5.3. [2010-07-12 15:32:33] paj...@php.net Again, it does it once and only once per path. When it does it, it checks each element of a path (and cache each of them too). [2010-07-12 14:59:36] v dot damore at gmail dot com I must also to notify that looking at our production servers in some cases PHP engine tries up to 8 times before read the file. Can you explain why PHP engine have this behavior? There is any way to remove/change this behavior in PHP engine? The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/bug.php?id=52312 -- Edit this bug report at http://bugs.php.net/bug.php?id=52312edit=1
Bug #52312 [Com]: PHP lstat problem
Edit report at http://bugs.php.net/bug.php?id=52312edit=1 ID: 52312 Comment by: v dot damore at gmail dot com Reported by: v dot damore at gmail dot com Summary: PHP lstat problem Status: Bogus Type: Bug Package: Safe Mode/open_basedir Operating System: Linux PHP Version: 5.2.13 New Comment: I tried again with a simple script test.php '? echo Ciao ?' realpath_cache_size=1024k realpath_cache_ttl=600 I have always same behavior (also second and following times I try to call curl http://damorealt.xoom.it/test.php: 13692 chdir(/usr/local/myspace/webspace/httpdocs) = 0 13692 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local/myspace/webspace/httpdocs, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local/myspace/webspace/httpdocs/test.php, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0 13692 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local/myspace/webspace/httpdocs, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local/myspace/webspace/httpdocs/test.php, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0 13692 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local/myspace/webspace/httpdocs, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local/myspace/webspace/httpdocs/test.php, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0 13692 open(/usr/local/myspace/webspace/httpdocs/test.php, O_RDONLY) = 16 13692 fstat(16, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0 13692 read(16, ? echo \Ciao!\ ?\n, 8192) = 19 13692 read(16, , 8192)= 0 13692 read(16, , 8192)= 0 13692 close(16) = 0 13692 chdir(/)= 0 Previous Comments: [2010-07-12 17:07:40] ras...@php.net phpinfo() is a special case. Try it with a simple hello world script. [2010-07-12 16:56:36] v dot damore at gmail dot com The real problem is that such full scan are repeated more then once: 25933 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local/myspace/webspace/httpdocs, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local/myspace/webspace/httpdocs/phpinfo.php, {st_mode=S_IFREG|0644, st_size=16, ...}) = 0 First check 25933 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local/myspace/webspace/httpdocs, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local/myspace/webspace/httpdocs/phpinfo.php, {st_mode=S_IFREG|0644, st_size=16, ...}) = 0 Second check 25933 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 Third check (incomplete) 25933 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933 lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 25933
Bug #52312 [Com]: PHP lstat problem
Edit report at http://bugs.php.net/bug.php?id=52312edit=1 ID: 52312 Comment by: v dot damore at gmail dot com Reported by: v dot damore at gmail dot com Summary: PHP lstat problem Status: Feedback Type: Bug Package: Safe Mode/open_basedir Operating System: Linux PHP Version: 5.2.13 New Comment: I have already tried with 5.3 and I was thinking to open an new bug because I have same behavior, there is only a change in the order of execution of lstat from fullpath to /usr : 7339 chdir(/usr/local/myspace/webspace/httpdocs) = 0 7339 lstat(/usr/local/myspace/webspace/httpdocs/test.php, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0 7339 lstat(/usr/local/myspace/webspace/httpdocs, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local/myspace/webspace/httpdocs/test.php, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0 7339 lstat(/usr/local/myspace/webspace/httpdocs, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local/myspace/webspace/httpdocs/test.php, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0 7339 lstat(/usr/local/myspace/webspace/httpdocs, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 open(/usr/local/myspace/webspace/httpdocs/test.php, O_RDONLY) = 16 7339 fstat(16, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0 7339 fstat(16, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0 7339 fstat(16, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0 7339 mmap(NULL, 19, PROT_READ, MAP_SHARED, 16, 0) = 0x2adfec195000 7339 munmap(0x2adfec195000, 19)= 0 7339 close(16) = 0 7339 chdir(/)= 0 Previous Comments: [2010-07-12 18:03:54] paj...@php.net Can you try with 5.3 please? [2010-07-12 17:51:24] v dot damore at gmail dot com I tried again with a simple script test.php '? echo Ciao ?' realpath_cache_size=1024k realpath_cache_ttl=600 I have always same behavior (also second and following times I try to call curl http://damorealt.xoom.it/test.php: 13692 chdir(/usr/local/myspace/webspace/httpdocs) = 0 13692 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local/myspace/webspace/httpdocs, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local/myspace/webspace/httpdocs/test.php, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0 13692 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local/myspace/webspace/httpdocs, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local/myspace/webspace/httpdocs/test.php, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0 13692 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local/myspace,
Bug #52312 [Com]: PHP lstat problem
Edit report at http://bugs.php.net/bug.php?id=52312edit=1 ID: 52312 Comment by: v dot damore at gmail dot com Reported by: v dot damore at gmail dot com Summary: PHP lstat problem Status: Feedback Type: Bug Package: Safe Mode/open_basedir Operating System: Linux PHP Version: 5.2.13 New Comment: where I have attach gdb, on 5.2.13 or on 5.3.2 ? Previous Comments: [2010-07-12 19:00:40] ras...@php.net I don't see that here. Attach gdb and set a breakpoint on lstat and see who is calling them. [2010-07-12 18:21:50] v dot damore at gmail dot com I have already tried with 5.3 and I was thinking to open an new bug because I have same behavior, there is only a change in the order of execution of lstat from fullpath to /usr : 7339 chdir(/usr/local/myspace/webspace/httpdocs) = 0 7339 lstat(/usr/local/myspace/webspace/httpdocs/test.php, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0 7339 lstat(/usr/local/myspace/webspace/httpdocs, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local/myspace/webspace/httpdocs/test.php, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0 7339 lstat(/usr/local/myspace/webspace/httpdocs, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local/myspace/webspace/httpdocs/test.php, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0 7339 lstat(/usr/local/myspace/webspace/httpdocs, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 open(/usr/local/myspace/webspace/httpdocs/test.php, O_RDONLY) = 16 7339 fstat(16, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0 7339 fstat(16, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0 7339 fstat(16, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0 7339 mmap(NULL, 19, PROT_READ, MAP_SHARED, 16, 0) = 0x2adfec195000 7339 munmap(0x2adfec195000, 19)= 0 7339 close(16) = 0 7339 chdir(/)= 0 [2010-07-12 18:03:54] paj...@php.net Can you try with 5.3 please? [2010-07-12 17:51:24] v dot damore at gmail dot com I tried again with a simple script test.php '? echo Ciao ?' realpath_cache_size=1024k realpath_cache_ttl=600 I have always same behavior (also second and following times I try to call curl http://damorealt.xoom.it/test.php: 13692 chdir(/usr/local/myspace/webspace/httpdocs) = 0 13692 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local/myspace/webspace/httpdocs, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local/myspace/webspace/httpdocs/test.php, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0 13692 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local/myspace/webspace/httpdocs, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local/myspace/webspace/httpdocs/test.php, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0 13692 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 13692 lstat(/usr/local,
Bug #52312 [Com]: PHP lstat problem
Edit report at http://bugs.php.net/bug.php?id=52312edit=1 ID: 52312 Comment by: v dot damore at gmail dot com Reported by: v dot damore at gmail dot com Summary: PHP lstat problem Status: Feedback Type: Bug Package: Safe Mode/open_basedir Operating System: Linux PHP Version: 5.2.13 New Comment: gdb reproduce the behavior reported in my comments, I have uploaded result of your request at http://damore.xoom.it/apache-2.2_php-5.3.2_break-lstat.txt Previous Comments: [2010-07-12 19:09:00] ras...@php.net 5.3. I haven't looked at 5.2 in 2+ years. [2010-07-12 19:07:06] v dot damore at gmail dot com where I have attach gdb, on 5.2.13 or on 5.3.2 ? [2010-07-12 19:00:40] ras...@php.net I don't see that here. Attach gdb and set a breakpoint on lstat and see who is calling them. [2010-07-12 18:21:50] v dot damore at gmail dot com I have already tried with 5.3 and I was thinking to open an new bug because I have same behavior, there is only a change in the order of execution of lstat from fullpath to /usr : 7339 chdir(/usr/local/myspace/webspace/httpdocs) = 0 7339 lstat(/usr/local/myspace/webspace/httpdocs/test.php, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0 7339 lstat(/usr/local/myspace/webspace/httpdocs, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local/myspace/webspace/httpdocs/test.php, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0 7339 lstat(/usr/local/myspace/webspace/httpdocs, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local/myspace/webspace/httpdocs/test.php, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0 7339 lstat(/usr/local/myspace/webspace/httpdocs, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local/myspace/webspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local/myspace, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr/local, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 lstat(/usr, {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 7339 open(/usr/local/myspace/webspace/httpdocs/test.php, O_RDONLY) = 16 7339 fstat(16, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0 7339 fstat(16, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0 7339 fstat(16, {st_mode=S_IFREG|0644, st_size=19, ...}) = 0 7339 mmap(NULL, 19, PROT_READ, MAP_SHARED, 16, 0) = 0x2adfec195000 7339 munmap(0x2adfec195000, 19)= 0 7339 close(16) = 0 7339 chdir(/)= 0 [2010-07-12 18:03:54] paj...@php.net Can you try with 5.3 please? The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/bug.php?id=52312 -- Edit this bug report at http://bugs.php.net/bug.php?id=52312edit=1
Bug #52312 [Com]: PHP lstat problem
Edit report at http://bugs.php.net/bug.php?id=52312edit=1 ID: 52312 Comment by: v dot damore at gmail dot com Reported by: v dot damore at gmail dot com Summary: PHP lstat problem Status: Feedback Type: Bug Package: Safe Mode/open_basedir Operating System: Linux PHP Version: 5.2.13 New Comment: Please note, gdb output I sent is related to third time I have called curl http://damorealt.xoom.it/test.php I have set break point as requested: (gdb) break realpath_cache_find Breakpoint 1 at 0x2b0b3c9f254d: file /usr/local/sitipersonali/sitipersonali01/NSP_SERVICE/strillo/sources/php-5.3.2/TSRM/tsrm_virtual_cwd.c, line 560. (gdb) bt #0 0x00391760db00 in __accept_nocancel () from /lib64/libpthread.so.0 #1 0x2b0b3c1f4544 in apr_socket_accept () from /usr/lib64/libapr-1.so.0 #2 0x004562e5 in unixd_accept () #3 0x00454006 in child_main () #4 0x0045416c in make_child () #5 0x00454701 in ap_mpm_run () #6 0x004220ef in main () (gdb) continue Continuing. During test call gdb as not broken execution. Function realpath_cache_find is not called. Previous Comments: [2010-07-13 00:33:12] ras...@php.net Actually, try this simple test.php script: pre ?php var_dump(realpath_cache_get()); ? /pre That should tell you what is getting cached. [2010-07-13 00:17:16] ras...@php.net It seems like your realpath cache isn't working at all. Could you set a breakpoint on realpath_cache_find and step into it the second time it hits those stat calls. Does it go into the while(bucket) loop there at all? [2010-07-12 23:48:10] v dot damore at gmail dot com gdb reproduce the behavior reported in my comments, I have uploaded result of your request at http://damore.xoom.it/apache-2.2_php-5.3.2_break-lstat.txt [2010-07-12 19:09:00] ras...@php.net 5.3. I haven't looked at 5.2 in 2+ years. [2010-07-12 19:07:06] v dot damore at gmail dot com where I have attach gdb, on 5.2.13 or on 5.3.2 ? The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/bug.php?id=52312 -- Edit this bug report at http://bugs.php.net/bug.php?id=52312edit=1
Bug #52312 [Com]: PHP lstat problem
Edit report at http://bugs.php.net/bug.php?id=52312edit=1 ID: 52312 Comment by: v dot damore at gmail dot com Reported by: v dot damore at gmail dot com Summary: PHP lstat problem Status: Feedback Type: Bug Package: Safe Mode/open_basedir Operating System: Linux PHP Version: 5.2.13 New Comment: I have executed script: pre ?php var_dump(realpath_cache_get()); ? /pre [r...@svilpar4 ~]# curl http://damorealt.xoom.it/test.php pre array(0) { } /pre Previous Comments: [2010-07-13 00:38:32] v dot damore at gmail dot com Please note, gdb output I sent is related to third time I have called curl http://damorealt.xoom.it/test.php I have set break point as requested: (gdb) break realpath_cache_find Breakpoint 1 at 0x2b0b3c9f254d: file /usr/local/sitipersonali/sitipersonali01/NSP_SERVICE/strillo/sources/php-5.3.2/TSRM/tsrm_virtual_cwd.c, line 560. (gdb) bt #0 0x00391760db00 in __accept_nocancel () from /lib64/libpthread.so.0 #1 0x2b0b3c1f4544 in apr_socket_accept () from /usr/lib64/libapr-1.so.0 #2 0x004562e5 in unixd_accept () #3 0x00454006 in child_main () #4 0x0045416c in make_child () #5 0x00454701 in ap_mpm_run () #6 0x004220ef in main () (gdb) continue Continuing. During test call gdb as not broken execution. Function realpath_cache_find is not called. [2010-07-13 00:33:12] ras...@php.net Actually, try this simple test.php script: pre ?php var_dump(realpath_cache_get()); ? /pre That should tell you what is getting cached. [2010-07-13 00:17:16] ras...@php.net It seems like your realpath cache isn't working at all. Could you set a breakpoint on realpath_cache_find and step into it the second time it hits those stat calls. Does it go into the while(bucket) loop there at all? [2010-07-12 23:48:10] v dot damore at gmail dot com gdb reproduce the behavior reported in my comments, I have uploaded result of your request at http://damore.xoom.it/apache-2.2_php-5.3.2_break-lstat.txt [2010-07-12 19:09:00] ras...@php.net 5.3. I haven't looked at 5.2 in 2+ years. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/bug.php?id=52312 -- Edit this bug report at http://bugs.php.net/bug.php?id=52312edit=1
Bug #52312 [Com]: PHP lstat problem
Edit report at http://bugs.php.net/bug.php?id=52312edit=1 ID: 52312 Comment by: v dot damore at gmail dot com Reported by: v dot damore at gmail dot com Summary: PHP lstat problem Status: Feedback Type: Bug Package: Safe Mode/open_basedir Operating System: Linux PHP Version: 5.2.13 New Comment: Please also note that realpath_cache_size and realpath_cache_ttl are currently set to following values: [r...@svilpar4 ~]# curl http://damorealt.xoom.it/phpinfo.php | grep real trtd class=erealpath_cache_size/tdtd class=v1024k/tdtd class=v1024k/td/tr trtd class=erealpath_cache_ttl/tdtd class=v600/tdtd class=v600/td/tr Previous Comments: [2010-07-13 00:47:13] v dot damore at gmail dot com I have executed script: pre ?php var_dump(realpath_cache_get()); ? /pre [r...@svilpar4 ~]# curl http://damorealt.xoom.it/test.php pre array(0) { } /pre [2010-07-13 00:38:32] v dot damore at gmail dot com Please note, gdb output I sent is related to third time I have called curl http://damorealt.xoom.it/test.php I have set break point as requested: (gdb) break realpath_cache_find Breakpoint 1 at 0x2b0b3c9f254d: file /usr/local/sitipersonali/sitipersonali01/NSP_SERVICE/strillo/sources/php-5.3.2/TSRM/tsrm_virtual_cwd.c, line 560. (gdb) bt #0 0x00391760db00 in __accept_nocancel () from /lib64/libpthread.so.0 #1 0x2b0b3c1f4544 in apr_socket_accept () from /usr/lib64/libapr-1.so.0 #2 0x004562e5 in unixd_accept () #3 0x00454006 in child_main () #4 0x0045416c in make_child () #5 0x00454701 in ap_mpm_run () #6 0x004220ef in main () (gdb) continue Continuing. During test call gdb as not broken execution. Function realpath_cache_find is not called. [2010-07-13 00:33:12] ras...@php.net Actually, try this simple test.php script: pre ?php var_dump(realpath_cache_get()); ? /pre That should tell you what is getting cached. [2010-07-13 00:17:16] ras...@php.net It seems like your realpath cache isn't working at all. Could you set a breakpoint on realpath_cache_find and step into it the second time it hits those stat calls. Does it go into the while(bucket) loop there at all? [2010-07-12 23:48:10] v dot damore at gmail dot com gdb reproduce the behavior reported in my comments, I have uploaded result of your request at http://damore.xoom.it/apache-2.2_php-5.3.2_break-lstat.txt The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/bug.php?id=52312 -- Edit this bug report at http://bugs.php.net/bug.php?id=52312edit=1
Bug #52312 [Com]: PHP lstat problem
Edit report at http://bugs.php.net/bug.php?id=52312edit=1 ID: 52312 Comment by: v dot damore at gmail dot com Reported by: v dot damore at gmail dot com Summary: PHP lstat problem Status: Feedback Type: Bug Package: Safe Mode/open_basedir Operating System: Linux PHP Version: 5.2.13 New Comment: After having set breakpoint tsrm_realpath_r and I have execute step by step debug. I think is interesting that after execution tsrm_virtual_cwd.c of line 681 execution continue on line 890. gdb) break tsrm_realpath_r Breakpoint 1 at 0x2b0b3c9f2702: file /usr/local/sitipersonali/sitipersonali01/NSP_SERVICE/strillo/sources/php-5.3.2/TSRM/tsrm_virtual_cwd.c, line 611. (gdb) continue Continuing. Breakpoint 1, tsrm_realpath_r (path=0x7fffddfb32b0 /usr/local/myspace/webspace/httpdocs/test.php, start=1, len=45, ll=0x7fffddfb32ac, t=0x7fffddfb32a0, use_realpath=2, is_dir=0, link_is_dir=0x0) at /usr/local/sitipersonali/sitipersonali01/NSP_SERVICE/strillo/sources/php-5.3.2/TSRM/tsrm_virtual_cwd.c:611 611 int directory = 0; (gdb) step 624 if (len = start) { (gdb) step 628 i = len; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 633 if (i == len || (gdb) step 639 } else if (i == len - 2 path[i] == '.' path[i+1] == '.') { (gdb) step 677 path[len] = 0; (gdb) step 679 save = (use_realpath != CWD_EXPAND); (gdb) step 681 if (start save CWDG(realpath_cache_size_limit)) { (gdb) watch save Hardware watchpoint 2: save (gdb) print save $1 = 1 (gdb) print start $2 = 1 (gdb) print realpath_cache_size_limit No symbol realpath_cache_size_limit in current context. (gdb) step 890 if (save lstat(path, st) 0) { (gdb) Previous Comments: [2010-07-13 00:59:44] ras...@php.net Set a bp and step through tsrm_realpath_r and figure out why it isn't getting to the realptath_cache_find() call there. Seems like it should be getting there from the backtraces. [2010-07-13 00:52:21] v dot damore at gmail dot com Please also note that realpath_cache_size and realpath_cache_ttl are currently set to following values: [r...@svilpar4 ~]# curl http://damorealt.xoom.it/phpinfo.php | grep real trtd class=erealpath_cache_size/tdtd class=v1024k/tdtd class=v1024k/td/tr trtd class=erealpath_cache_ttl/tdtd class=v600/tdtd class=v600/td/tr [2010-07-13 00:47:13] v dot damore at gmail dot com I have executed script: pre ?php var_dump(realpath_cache_get()); ? /pre [r...@svilpar4 ~]# curl http://damorealt.xoom.it/test.php pre array(0) { } /pre [2010-07-13 00:38:32] v dot damore at gmail dot com Please note, gdb output I sent is related to third time I have called curl http://damorealt.xoom.it/test.php I have set break point as requested: (gdb) break realpath_cache_find Breakpoint 1 at 0x2b0b3c9f254d: file /usr/local/sitipersonali/sitipersonali01/NSP_SERVICE/strillo/sources/php-5.3.2/TSRM/tsrm_virtual_cwd.c, line 560. (gdb) bt #0 0x00391760db00 in __accept_nocancel () from /lib64/libpthread.so.0 #1 0x2b0b3c1f4544 in apr_socket_accept () from /usr/lib64/libapr-1.so.0 #2 0x004562e5 in unixd_accept () #3 0x00454006 in child_main () #4 0x0045416c in make_child () #5 0x00454701 in ap_mpm_run () #6 0x004220ef in main () (gdb) continue Continuing. During test call gdb as not broken execution. Function realpath_cache_find is not called.
Bug #52312 [Com]: PHP lstat problem
Edit report at http://bugs.php.net/bug.php?id=52312edit=1 ID: 52312 Comment by: v dot damore at gmail dot com Reported by: v dot damore at gmail dot com Summary: PHP lstat problem Status: Feedback Type: Bug Package: Safe Mode/open_basedir Operating System: Linux PHP Version: 5.2.13 New Comment: There is a interesting update, I have found CWDG define so now we have: (gdb) print cwd_globals.realpath_cache_size_limit $3 = 0 Probably you should check why realpath_cache_size_limit is equal to 0 Previous Comments: [2010-07-13 01:30:24] v dot damore at gmail dot com After having set breakpoint tsrm_realpath_r and I have execute step by step debug. I think is interesting that after execution tsrm_virtual_cwd.c of line 681 execution continue on line 890. gdb) break tsrm_realpath_r Breakpoint 1 at 0x2b0b3c9f2702: file /usr/local/sitipersonali/sitipersonali01/NSP_SERVICE/strillo/sources/php-5.3.2/TSRM/tsrm_virtual_cwd.c, line 611. (gdb) continue Continuing. Breakpoint 1, tsrm_realpath_r (path=0x7fffddfb32b0 /usr/local/myspace/webspace/httpdocs/test.php, start=1, len=45, ll=0x7fffddfb32ac, t=0x7fffddfb32a0, use_realpath=2, is_dir=0, link_is_dir=0x0) at /usr/local/sitipersonali/sitipersonali01/NSP_SERVICE/strillo/sources/php-5.3.2/TSRM/tsrm_virtual_cwd.c:611 611 int directory = 0; (gdb) step 624 if (len = start) { (gdb) step 628 i = len; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 633 if (i == len || (gdb) step 639 } else if (i == len - 2 path[i] == '.' path[i+1] == '.') { (gdb) step 677 path[len] = 0; (gdb) step 679 save = (use_realpath != CWD_EXPAND); (gdb) step 681 if (start save CWDG(realpath_cache_size_limit)) { (gdb) watch save Hardware watchpoint 2: save (gdb) print save $1 = 1 (gdb) print start $2 = 1 (gdb) print realpath_cache_size_limit No symbol realpath_cache_size_limit in current context. (gdb) step 890 if (save lstat(path, st) 0) { (gdb) [2010-07-13 00:59:44] ras...@php.net Set a bp and step through tsrm_realpath_r and figure out why it isn't getting to the realptath_cache_find() call there. Seems like it should be getting there from the backtraces. [2010-07-13 00:52:21] v dot damore at gmail dot com Please also note that realpath_cache_size and realpath_cache_ttl are currently set to following values: [r...@svilpar4 ~]# curl http://damorealt.xoom.it/phpinfo.php | grep real trtd class=erealpath_cache_size/tdtd class=v1024k/tdtd class=v1024k/td/tr trtd class=erealpath_cache_ttl/tdtd class=v600/tdtd class=v600/td/tr [2010-07-13 00:47:13] v dot damore at gmail dot com I have executed script: pre ?php var_dump(realpath_cache_get()); ? /pre [r...@svilpar4 ~]# curl http://damorealt.xoom.it/test.php pre array(0) { } /pre [2010-07-13 00:38:32] v dot damore at gmail dot com Please note, gdb output I sent is related to third time I have called curl http://damorealt.xoom.it/test.php I have set break point as requested: (gdb) break realpath_cache_find Breakpoint 1 at 0x2b0b3c9f254d: file /usr/local/sitipersonali/sitipersonali01/NSP_SERVICE/strillo/sources/php-5.3.2/TSRM/tsrm_virtual_cwd.c, line 560. (gdb) bt #0 0x00391760db00 in __accept_nocancel () from /lib64/libpthread.so.0 #1 0x2b0b3c1f4544 in apr_socket_accept () from /usr/lib64/libapr-1.so.0
Bug #52312 [Com]: PHP lstat problem
Edit report at http://bugs.php.net/bug.php?id=52312edit=1 ID: 52312 Comment by: v dot damore at gmail dot com Reported by: v dot damore at gmail dot com Summary: PHP lstat problem Status: Feedback Type: Bug Package: Safe Mode/open_basedir Operating System: Linux PHP Version: 5.2.13 New Comment: I found where the problem is, this behavior is not a bug. Looking at main/main.c I found following lines: 1416: /* Disable realpath cache if safe_mode or open_basedir are set */ if (PG(safe_mode) || (PG(open_basedir) *PG(open_basedir))) { CWDG(realpath_cache_size_limit) = 0; } 1978: /* Disable realpath cache if safe_mode or open_basedir are set */ if (PG(safe_mode) || (PG(open_basedir) *PG(open_basedir))) { CWDG(realpath_cache_size_limit) = 0; } Could you explain why if safe_mode or open_basedir are set realpath cache is disabled? Previous Comments: [2010-07-13 01:38:26] v dot damore at gmail dot com There is a interesting update, I have found CWDG define so now we have: (gdb) print cwd_globals.realpath_cache_size_limit $3 = 0 Probably you should check why realpath_cache_size_limit is equal to 0 [2010-07-13 01:30:24] v dot damore at gmail dot com After having set breakpoint tsrm_realpath_r and I have execute step by step debug. I think is interesting that after execution tsrm_virtual_cwd.c of line 681 execution continue on line 890. gdb) break tsrm_realpath_r Breakpoint 1 at 0x2b0b3c9f2702: file /usr/local/sitipersonali/sitipersonali01/NSP_SERVICE/strillo/sources/php-5.3.2/TSRM/tsrm_virtual_cwd.c, line 611. (gdb) continue Continuing. Breakpoint 1, tsrm_realpath_r (path=0x7fffddfb32b0 /usr/local/myspace/webspace/httpdocs/test.php, start=1, len=45, ll=0x7fffddfb32ac, t=0x7fffddfb32a0, use_realpath=2, is_dir=0, link_is_dir=0x0) at /usr/local/sitipersonali/sitipersonali01/NSP_SERVICE/strillo/sources/php-5.3.2/TSRM/tsrm_virtual_cwd.c:611 611 int directory = 0; (gdb) step 624 if (len = start) { (gdb) step 628 i = len; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 630 i--; (gdb) step 629 while (i start !IS_SLASH(path[i-1])) { (gdb) step 633 if (i == len || (gdb) step 639 } else if (i == len - 2 path[i] == '.' path[i+1] == '.') { (gdb) step 677 path[len] = 0; (gdb) step 679 save = (use_realpath != CWD_EXPAND); (gdb) step 681 if (start save CWDG(realpath_cache_size_limit)) { (gdb) watch save Hardware watchpoint 2: save (gdb) print save $1 = 1 (gdb) print start $2 = 1 (gdb) print realpath_cache_size_limit No symbol realpath_cache_size_limit in current context. (gdb) step 890 if (save lstat(path, st) 0) { (gdb) [2010-07-13 00:59:44] ras...@php.net Set a bp and step through tsrm_realpath_r and figure out why it isn't getting to the realptath_cache_find() call there. Seems like it should be getting there from the backtraces. [2010-07-13 00:52:21] v dot damore at gmail dot com Please also note that realpath_cache_size and realpath_cache_ttl are currently set to following values: [r...@svilpar4 ~]# curl http://damorealt.xoom.it/phpinfo.php | grep real trtd class=erealpath_cache_size/tdtd class=v1024k/tdtd class=v1024k/td/tr trtd class=erealpath_cache_ttl/tdtd class=v600/tdtd class=v600/td/tr [2010-07-13 00:47:13] v dot damore at gmail dot com I have