Re: PHP Embedded
| From: | Johannes Schlueter | Date: | Tue, 14 Mar 2006 20:58:25 +0000 |
| Subject: | Re: PHP Embedded | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-22428@lists.php.net to get a copy of this message | ||
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