<HTML ><HEAD ><TITLE >shmop_open</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="Manual de PHP" HREF="index.html"><LINK REL="UP" TITLE="Shared Memory Functions" HREF="ref.shmop.html"><LINK REL="PREVIOUS" TITLE="shmop_delete" HREF="function.shmop_delete.html"><LINK REL="NEXT" TITLE="shmop_read" HREF="function.shmop_read.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" >Manual de PHP</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.shmop_delete.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.shmop_read.html" ACCESSKEY="N" >Siguiente</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.shmop_open" ></A >shmop_open</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN70474" ></A ><P > (PHP 4 >= 4.0.4)</P >shmop_open -- Create or open shared memory block</DIV ><DIV CLASS="refsect1" ><A NAME="AEN70477" ></A ><H2 >Description</H2 >int <B CLASS="methodname" >shmop_open</B > ( int key, string flags, int mode, int size)<BR ></BR ><P > <B CLASS="function" >shmop_open()</B > can create or open a shared memory block. </P ><P > <B CLASS="function" >shmop_open()</B > takes 4 parameters: key, which is the system's id for the shared memory block, this parameter can be passed as a decimal or hex. The second parameter are the flags that you can use: <P ></P ><UL ><LI ><P > "a" for access (sets IPC_EXCL) use this flag when you need to open an existing shared memory segment </P ></LI ><LI ><P > "c" for create (sets IPC_CREATE) use this flag when you need to create a new shared memory segment. </P ></LI ></UL > The third parameter is the mode, which are the permissions that you wish to assign to your memory segment, those are the same as permission for a file. Permissions need to be passed in octal form ex. 0644. The last parameter is size of the shared memory block you wish to create in bytes. <DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Nota: </B > Note: the 3rd and 4th should be entered as 0 if you are opening an existing memory segment. On success <B CLASS="function" >shmop_open()</B > will return an id that you can use to access the shared memory segment you've created. </P ></BLOCKQUOTE ></DIV > </P ><P > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN70507" ></A ><P ><B >Ejemplo 1. Create a new shared memory block</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="php" ><?php $shm_id = shmop_open(0x0fff, "c", 0644, 100); ?></PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ><P > This example opened a shared memory block with a system id of 0x0fff. </P ></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.shmop_delete.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Inicio</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.shmop_read.html" ACCESSKEY="N" >Siguiente</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >shmop_delete</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.shmop.html" ACCESSKEY="U" >Subir</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >shmop_read</TD ></TR ></TABLE ></DIV ></BODY ></HTML >