Re: Embedding PHP, few additional questions.
| From: | Johannes Schlüter | Date: | Fri, 27 Jun 2014 09:18:36 +0000 |
| Subject: | Re: Embedding PHP, few additional questions. | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-75111@lists.php.net to get a copy of this message | ||
On Fri, 2014-06-27 at 07:57 +0200, Ingwie Phoenix wrote:
> I also did some research, and learned that OPCaches are stored in
> shared memory. Wouldn’t shared memory get lost when the interpreter is
> shut down, or how is this working? Is shared memory actually „fully
> associated“ to a program? Excuse me for the dumb question, It is just
> my first direct confrontation with shared memory, ever.
In general "shared memory" might mean many things. In this opcache case
you can assume that when PHP is shutdown (not only the request) the
shared memory is freed.
> In your pconn SAPI, you are telling PHP that you are not going to use
> headers… but, in my case, I have an incomming HTTP request and should
> very much forward those headers. What is the function that I must look
> at, to copy my headers?
php-src/sapi/ has quite a few examples and php-src/main/SAPI.c and
related files show implementation of details. If you're referring to the
no_headers flag this is about setting headers from PHP which would
otherwise be sent to the SAPI's header hooks ...
> As this is going to be a nodejs module (v8php), I will link most of
> these functions into JS scope by supplying wrappers and the like.
> Going to be pretty interesting to see this in actual work, and
> comparign the speed to just using child_process.spawn.
It will be worse - without really looking into child_process.spawn I
assume that is non-blocking. I assume you're PHP implementation will be
blocking and therefore hold all other things in nodejs. For making it
non-blocking you'd have to play a bit with threads and send PHP of to
worker threads and ensure it's compiled in TSRM mode which costs extra
time while executing. The better approach would be to use FastCGI / FPM
as communication with PHP. While I'd question the architecture of such
an system ...
johannes