Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:22428 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 7658 invoked by uid 1010); 14 Mar 2006 20:59:44 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 7643 invoked from network); 14 Mar 2006 20:59:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Mar 2006 20:59:44 -0000 X-Host-Fingerprint: 212.227.48.61 mayflowerholding.com Linux 2.5 (sometimes 2.4) (4) Received: from ([212.227.48.61:42363] helo=s15175637.rootmaster.info) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id A2/38-55982-FBE27144 for ; Tue, 14 Mar 2006 15:59:43 -0500 Received: (qmail 7769 invoked by uid 2520); 14 Mar 2006 21:59:40 +0100 Received: from 82.135.68.143 by s15175637 (envelope-from , uid 2020) with qmail-scanner-1.25st (uvscan: v4.4.00/v4716. spamassassin: 3.0.3. perlscan: 1.25st. Clear:RC:0(82.135.68.143):SA:0(-0.6/7.0):. Processed in 1.215961 secs); 14 Mar 2006 20:59:40 -0000 X-Spam-Status: No, hits=-0.6 required=7.0 Received: from ppp-82-135-68-143.mnet-online.de (HELO ?192.168.1.102?) (82.135.68.143) by mayflowerholding.com with (DHE-RSA-AES256-SHA encrypted) SMTP; 14 Mar 2006 21:59:39 +0100 To: internals@lists.php.net Date: Tue, 14 Mar 2006 21:58:25 +0100 User-Agent: KMail/1.9.1 Cc: Marco References: <2fd662a00603141148n1f3c6aw@mail.gmail.com> In-Reply-To: <2fd662a00603141148n1f3c6aw@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-ID: <200603142158.25640.johannes@php.net> Subject: Re: [PHP-DEV] PHP Embedded From: johannes@php.net (Johannes Schlueter) Hi Mark, On Tuesday 14 March 2006 20:48, Marco wrote: > Is there a way from within the embedded system to destroy all created > variables so that the environment is the same as when it was started or do > we need to shutdown the embedded engine and start it up again? PHP was designed as an language running as an module inside an webserver to run multiple, independent, request, one after each other. So PHP supports reinitilizing the engine without restarting everything. Look around for php_request_startup() and php_request_shutdown() and how they are used. > Also a problem they are coming up with occasionally is that the php engine > will crash when > > php_embed_init(argc, argv PTSRMLS_CC); > > is called, they havent found any reproducible steps yet. Could this be > caused by shutting down and starting up the emdedded engine from within the > same app? I have asked and the application isnt multi threaded. Here one can't say much without any details (_relevant_ code and backtrace) php_embed_* are afaik wrapping up the complete engine und request init and shutdown. If you want to do multiple independent requests you should take an a bit closer look on the SAPI layer to use the functions I mentioned above. > Finally is there any examples of how to embed php in a windows app? I have > done some googling and have found odd code snippets but if there is a > detailed doc I could read I would be most grateful. > > Thanks in advance for any information provided. There are quite a few "embedding PHP in an application"-examples in php-src/sapi. If you don't like reading that code wait some weeks and you might get Sara Golemon's not yet released book (ISBN: 067232704X) about "Extending and Embedding PHP" if that's to late you might want to fetch George Schlossnagle's (ISBN: 0672325616) which is anyways a good read about "Advanced PHP Programming" and has a few chapters about PHP internals like the SAPI layer. johanne