[英]is it possible to share memory between PHP and C in Windows?
I think that it may be possible if you create your own PHP extension. 我认为,如果您创建自己的PHP扩展,则有可能。 As far as I know, PHP extensions are written in C language. 据我所知,PHP扩展是用C语言编写的。
Probably, there are already some extensions written to do this thing. 可能已经编写了一些扩展来执行此操作。
UPD: 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 . 请在官方文档中查看本章: http : //php.net/manual/zh/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 这是一些示例: http : //www.raspberry-projects.com/pi/programming-in-c/memory/shared-memory-between-c-application-and-php-web-server
UPD 2: 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++ . 我对共享内存和内存映射文件不是很熟悉,但是看起来这些问题在某种程度上与您的问题类似: 共享内存C ++-PHP和PHP-访问使用C ++创建的共享内存 。
Also, you might be interested to read a book "Advanced PHP Programming" by George Schlossnagle ( link ). 另外,您可能有兴趣阅读George Schlossnagle( link )所著的“ Advanced PHP Programming”一书。 It looks like there is an example of how to implement a PHP extension to work with memory-mapped files. 似乎有一个示例,说明如何实现PHP扩展以使用内存映射文件。
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. 从上面的链接开始,我已经能够编写一个PHP扩展和一个简单的程序,它们共享相同的命名共享内存。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.