Can you use shared memory between a PHP script and a C/C++ program in Windows? For instance, by using PHP shared memory (link) and windows memory mapped files?
2 Answers
I think that it may be possible if you create your own PHP extension. As far as I know, PHP extensions are written in C language.
Probably, there are already some extensions written to do this thing.
UPD:
It looks like it is possible. Please, take a look at this chapter in official docs: http://php.net/manual/en/book.shmop.php. And here is some example: http://www.raspberry-projects.com/pi/programming-in-c/memory/shared-memory-between-c-application-and-php-web-server
UPD 2:
I'm not very familiar with shared memory and memory mapped files, but it looks like these questions are somehow similar to yours: Shared memory C++ - PHP and PHP - Access shared Memory created with C++.
Also, you might be interested to read a book "Advanced PHP Programming" by George Schlossnagle (link). It looks like there is an example of how to implement a PHP extension to work with memory-mapped files.
Yes, it is possible. Starting from the links above I have been able to write a PHP extesion and a simple program which share the same Named Shared Memory.

- 21
- 2