This code doesn’t work. I set up a full fledged example based on the reading from comments by Robert who linked a lua and php discussion/documentation. Note, those are independent sources, so…
producer.lua
local shmem = require("shmem")
local mem = shmem.new(1024)
body = "some kind of test"
mem:write(body)
consumer.php
<?php
$shm_id = shmop_open(0xff3,"c",0644,1024);
if (!$shm_id) { echo "couldn't create shared memory segment`n"; }
$shm_size = shmop_size($shm_id);
$mystring = shmop_read($shm_id, 0, $shm_size);
echo $mystring . "ipsum lorem" . $mystring
shmop_close($shm_id); ?>
And that is end of file. Of course the only thing output by php is ipsum lorem. I would have expected “some kind of testipsumloremsome kind of test”.
Note, I’d love a universal and dynamic system beyond the scope of lua and php, however, that is the framework I had tried to work within and because we need a narrow scope I will ask for an answer that applies to just this. Cheers
user28793105 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
23