<HTML ><HEAD ><TITLE >shm_attach</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="PHP Manual" HREF="index.html"><LINK REL="UP" TITLE="Semaphore, Shared Memory and IPC Functions" HREF="ref.sem.html"><LINK REL="PREVIOUS" TITLE="sem_remove" HREF="function.sem-remove.html"><LINK REL="NEXT" TITLE="shm_detach" HREF="function.shm-detach.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=ISO-8859-1"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP Manual</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.sem-remove.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.shm-detach.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.shm-attach" ></A >shm_attach</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN82697" ></A ><P > (PHP 3>= 3.0.6, PHP 4 )</P >shm_attach -- Creates or open a shared memory segment</DIV ><DIV CLASS="refsect1" ><A NAME="AEN82700" ></A ><H2 >Description</H2 >int <B CLASS="methodname" >shm_attach</B > ( int key [, int memsize [, int perm]])<BR ></BR ><P > <B CLASS="function" >shm_attach()</B > returns an id that that can be used to access the System V shared memory with the given key, the first call creates the shared memory segment with mem_size (default: sysvshm.init_mem in the <A HREF="configuration.html#configuration.file" >configuration file</A >, otherwise 10000 bytes) and the optional perm-bits (default: 0666). </P ><P > A second call to <B CLASS="function" >shm_attach()</B > for the same <TT CLASS="parameter" ><I >key</I ></TT > will return a different shared memory identifier, but both identifiers access the same underlying shared memory. <TT CLASS="parameter" ><I >Memsize</I ></TT > and <TT CLASS="parameter" ><I >perm</I ></TT > will be ignored. </P ><P > See also: <A HREF="function.ftok.html" ><B CLASS="function" >ftok()</B ></A >. </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Note: </B > This function does not work on Windows systems. </P ></BLOCKQUOTE ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.sem-remove.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.shm-detach.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >sem_remove</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.sem.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >shm_detach</TD ></TR ></TABLE ></DIV ></BODY ></HTML >