📒 참고자료 : https://www.php.net/manual/en/book.sem.php
<?php
$sem_data_key = 1000;
$shm_data_key = 2000;
$permission = 0666;
$buffer_size = 256;
$sem_id = sem_get($sem_data_key);
$shm_id = shmop_open($shm_data_key, 'w', $permission, $buffer_size); // shared memory를 open 할 때 mode는 여러가지. read, write 목적이기 때문에 'w'로 지정함.
if (sem_acquire($sem_id)){
$read_data = shmop_read($shm_id, 0, shmop_size($shm_id));
echo ($read_data);
}
sem_release($sem_id);
?>