Shared Memory/Shmop on Windows
| From: | Gary Penn | Date: | Tue, 29 Jan 2002 22:22:26 +0000 |
| Subject: | Shared Memory/Shmop on Windows | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-11703@lists.php.net to get a copy of this message | ||
I am porting a website from a Unix server to IIS 5.0 on W2K Advanced
Server. The PHP code currently is using Shared Memory calls. My
developer tells me the information is shmop-based.
Here's a sample of the code. The site is not functioning as it's
supposed to and I believe this may be the reason. Does anyone have
suggestions? I'm a newbie to PHP.
<?
$sharedmemory_pclass = true;
define(SHMEM_INDEX_ID, 0x77770);
define(SHMEM_SESSION_ID, 0x77771);
define(SHMEM_LOCKSEM, 0x77772);
define(SHMEM_INDEX_SIZE, 262144);
define(SHMEM_SHARED_SIZE, 1048576);
define(SHMEM_SEQUENCE_KEY, 1);
define(SHMEM_INDEX_KEY, 2);
define(SHMEM_COLLECT_KEY, 3);
class SharedMemory {
var $_IndexSem;
var $_IndexShr;
var $sessionShr;
var $next_collect; /* Timestamp of next expected garbage collect */
function SharedMemory()
{
//try to create the memory shares
// 2001-03-05 JvO: this does not seem to work; let's just hope the
segments are detached at process exit
// register_shutdown_function("_onExit");
$this->_IndexShr = @shm_attach(SHMEM_INDEX_ID, SHMEM_INDEX_SIZE);
$this->sessionShr = @shm_attach(SHMEM_SESSION_ID,
SHMEM_SHARED_SIZE);
$this->next_collect = @shm_get_var($this->_IndexShr,
SHMEM_COLLECT_KEY);
if ($this->next_collect <= 0)
$this->next_collect = 0x7fffffff; /* way into the future :) */
}
function destroy() {
@shm_detach($this->_IndexShr);
@shm_detach($this->sessionShr);
}
// private functions
=========================================
Gary Penn, MCSE, MCP+I, OCP
Webmaster/Systems Support, Shimano, Inc.
One Holland, Irvine, CA 92618 USA
+1 949 9515003 | Fax +1 949 9516212
http://www.shimano.com
_________________________________________