The following are common php shared memory functions used for inter-process communication.
Shm_attach-Creates or open a shared memory segment
Shm_detach-Disconnects from shared memory segment
Shm_get_var-Returns a variable from shared memory
Shm_has_var-Check whether a specific entry exists
Shm_put_var-Inserts or updates a variable in shared memory
Shm_remove_var-Removes a variable from shared memory
Shm_remove-Removes shared memory from Unix systems
$ Msg_key = 1; $ ipc_key = ftok (_ FILE __, 'T'); $ seg = shm_attach ($ ipc_key, 0600 ); // create or open a shared memory segment if (! $ Seg) {die ('create or open shared memory segment failed! ');} Shm_put_var ($ seg, $ msg_key, 'Hello World'); if (shm_has_var ($ seg, $ msg_key) {$ content = shm_get_var ($ seg, $ msg_key); echo $ content;} shm_remove_var ($ seg, $ msg_key); shm_remove ($ seg );
Output: hello world