<?php // You will probably need to protect shared memory with other synchronization objects. // Shared memory goes away when the last reference to it disappears. $mem = new SyncSharedMemory("AppReportName", 1024); if ($mem->first()) { // Do first time initialization work here. }