|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-04-23 13:50 UTC] don dot raman at microsoft dot com
[2010-04-24 06:01 UTC] RQuadling at GMail dot com
[2010-04-26 16:57 UTC] don dot raman at microsoft dot com
[2010-04-27 06:32 UTC] RQuadling at GMail dot com
[2010-04-27 13:56 UTC] don dot raman at microsoft dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 14:00:01 2025 UTC |
Description: ------------ Currently, to allow multiple CLI based scripts to share wincache_ucache, the environment variable APP_POOL_ID must exist prior to the first script being loaded. This may not always be possible, especially when the script is not being run from the command line. If the environment variable doesn't exist, then wincache uses the parent process's process id to identify the cache. This could be the process id of cmd.exe when launched manually, or srvany.exe (part of MS Resource Tool Kit) if running as a service or php.exe if script a launches script b. I'm using COM WShell->Run() to create non blocking child processes. Under these conditions, the child processes correctly identify the parent process (all the children see the same parent), but the parent process is looking at its parent, the cmd.exe or srvany.exe As such, there are different results to getppid() when using APP_POOL_ID is not set With that, the parent script cannot access the wincache_ucache of the child scripts. I would suggest the following logic when APP_POOL_ID does not exist. 1 - Find this process's id in the process snapshot. 2 - Find the top most process id for the same process name (pe.szExeFile I think is the place to look). If it was possible to set the identifier at run-time, then the value could be passed to the child scripts, just like the session id gets passed in cookies, etc. Reproduce code: --------------- <?php function showCache() { echo 'Last updated by instance #', wincache_ucache_get('i_Instance'), ' at ', date('r', wincache_ucache_get('f_Current')), "\r"; } if (!isset($argv[1])) { wincache_ucache_add('i_Instance', 0); wincache_ucache_add('f_Current', $Start = microtime(True)); $WshShell = new COM("WScript.Shell"); foreach(range(1, 3) as $Task) { echo "Starting Task:$Task" . PHP_EOL; $oExec = $WshShell->Run(__FILE__ . " $Task", 9, false); } while(microtime(True) < ($f_Start + 100)){ showCache(); } } else { foreach(range(1, 100) as $Step) { wincache_ucache_set('i_Instance', $argv[1]); wincache_ucache_set('f_Current', microtime(true)); showCache(); time_sleep_until(microtime(True) + rand(1, 500) / 100); } } Expected result: ---------------- The main window will show a changing value for the updates to the cache. Actual result: -------------- No changes.