Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75109 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62138 invoked from network); 27 Jun 2014 05:58:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Jun 2014 05:58:12 -0000 Authentication-Results: pb1.pair.com smtp.mail=ingwie2000@googlemail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ingwie2000@googlemail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain googlemail.com designates 74.125.82.174 as permitted sender) X-PHP-List-Original-Sender: ingwie2000@googlemail.com X-Host-Fingerprint: 74.125.82.174 mail-we0-f174.google.com Received: from [74.125.82.174] ([74.125.82.174:41509] helo=mail-we0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 10/A5-11209-FE70DA35 for ; Fri, 27 Jun 2014 01:58:09 -0400 Received: by mail-we0-f174.google.com with SMTP id u57so4820054wes.33 for ; Thu, 26 Jun 2014 22:58:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=FZyyWZ8D7xVWthS+V7WrQZSQYrrd/wxHrxTKmm46Z7k=; b=IW+SzfdcJQslXKyswgJq3yOPdWyMYHF+9EmhfQH8FtHMxwLTgcaFTI0qNJX2rm72ZA vvccIYdm/VMYSk4jB8Ys6mun6+XXJBmFyG9PPCj6PPHQRper2urB+aUbt2ZCSKS3XqhM LhIV/QtBUB8XkUCnhNWlEOSusWqoBTsl87NMJPjFis552CS8+QDKH4HhSC+5hF5xK1xy vKhb6OatQ01gysS7PWivk3LCg6K4KtNya9XGZnuWxLdw71s/JHwzcC10gJ6fiH6dUO8Q D0kEuL7tibqE3lzaoS0GlxS8DcrqIdf+Z5WdzuGclPj2A74ziJdRnoo5YUl3/GUwc8xb 3Oxg== X-Received: by 10.194.237.135 with SMTP id vc7mr23760366wjc.86.1403848684901; Thu, 26 Jun 2014 22:58:04 -0700 (PDT) Received: from juergenensimac6.speedport_w723_v_typ_a_1_01_001 (p5B1500CB.dip0.t-ipconnect.de. [91.21.0.203]) by mx.google.com with ESMTPSA id ex4sm74002389wic.2.2014.06.26.22.58.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Jun 2014 22:58:04 -0700 (PDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.2\)) In-Reply-To: <1403777679.12695.14.camel@guybrush> Date: Fri, 27 Jun 2014 07:57:57 +0200 Cc: internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: <0DF815F8-5991-46EC-9BD4-53575F774BAC@googlemail.com> References: <1403777679.12695.14.camel@guybrush> To: =?windows-1252?Q?Johannes_Schl=FCter?= X-Mailer: Apple Mail (2.1878.2) Subject: Re: [PHP-DEV] Embedding PHP, few additional questions. From: ingwie2000@googlemail.com (Ingwie Phoenix) Am 26.06.2014 um 12:14 schrieb Johannes Schl=FCter = : > Hi, >=20 >=20 > On Thu, 2014-06-26 at 11:50 +0200, Ingwie Phoenix wrote: >> I am working on a nodejs module that allows to embed PHP (to use it >> within HTTP servers, for example). I wish to extend with a small >> thing. Instead of starting, running and shutting down the engine, I >> would like to keep it running, and just reset its state. Why? I >> *think* that this would keep my OPCache. Sadly, I did not find any >> documentation on how OPCache saved its=85cache. Its just ment as a >> matter of speed improvement. >>=20 >> How can I just reset the engine, without shutting it down? >=20 > I don't now what you mean by "reset" PHP is meant to serve requests, = one > after another, where each request has its own context. Probably = youwant > to run request cycles? >=20 >> The embedding instructions that I will use are here: >> http://phi.lv/?p=3D376 >=20 > This sees to use the high level embed APIs. Use > php_request_startup(TSRMLS_C); ... php_request_shutdown((void *) 0); > style loops. See embed API implementation, and a simple SAPI like > = https://github.com/johannes/pconn-sapi/blob/master/pconnect-sapi.c#L180 >=20 > johannes Hey. So I just looked into the pconn source and SAPI that you linked. Its = basically easy, if there wasnt the rather confusing tsrm bits here and = there. But I think I would just copy them=85 I also did some research, and learned that OPCaches are stored in shared = memory. Wouldn=92t shared memory get lost when the interpreter is shut = down, or how is this working? Is shared memory actually =84fully = associated=93 to a program? Excuse me for the dumb question, It is just = my first direct confrontation with shared memory, ever. In your pconn SAPI, you are telling PHP that you are not going to use = headers=85 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? 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. Kind regards, Ingwie.=