documentation of php5ts.dll and .NET wrapper

php.internals

muquaddim

19 years ago
Hi, I have use dumpbin to get the method names of php5ts.dll file. I get many names. 2 of these methods are, "php_execute_script" "php_execute_simple_script" I guess these are the methods that are responsible for executing php source (.php) files. now I need to know, what are the parameter of these methods. How can I get the documenttation on parameters. If I get this I could have make a .NET wrapper. Thanks

Tijnema !

19 years ago
On 6/17/07, muquaddim <shiplu.net@gmail.com> wrote:
> Hi, > I have use dumpbin to get the method names of php5ts.dll file. I get many > names. > 2 of these methods are, > "php_execute_script" > "php_execute_simple_script" > > I guess these are the methods that are responsible for executing php source > (.php) files. > now I need to know, what are the parameter of these methods. How can I get > the documenttation on parameters. > If I get this I could have make a .NET wrapper. > Thanks
Just take a look at the PHP Source code, the functions are well described there... :) Tijnema

muquaddim

19 years ago
"Tijnema" <tijnema@gmail.com> wrote in message news:d8269d910706170905h7c53fbd4sec26625dfaceda0b@mail.gmail.com...
> On 6/17/07, muquaddim <shiplu.net@gmail.com> wrote: >> Hi, >> I have use dumpbin to get the method names of php5ts.dll file. I get many >> names. >> 2 of these methods are, >> "php_execute_script" >> "php_execute_simple_script" >> >> I guess these are the methods that are responsible for executing php >> source >> (.php) files. >> now I need to know, what are the parameter of these methods. How can I >> get >> the documenttation on parameters. >> If I get this I could have make a .NET wrapper. >> Thanks > > Just take a look at the PHP Source code, the functions are well > described there... :) > > Tijnema
Yes I have been watching the source for long time. But no hope. There is no comments on the source. In the /main/main.c file I found this, PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC) here TSRMLS_DC is defined in /Zend/zend_language_scanner.c file as ------------------------------------------------------------- #ifdef ZTS #define TSRMLS_D void ***tsrm_ls #define TSRMLS_DC , TSRMLS_D #define TSRMLS_C tsrm_ls #define TSRMLS_CC , TSRMLS_C #else #define TSRMLS_D #define TSRMLS_DC #define TSRMLS_C #define TSRMLS_CC #endif ------------------------------------------------------------- this is contitional compilation. thats why I dont' know where the php_execute_script method int php5ts.dll has the last parameter. I think you understand. The main problem with the last parameter

Tijnema !

19 years ago
On 6/17/07, muquaddim <shiplu.net@gmail.com> wrote:
> > "Tijnema" <tijnema@gmail.com> wrote in message > news:d8269d910706170905h7c53fbd4sec26625dfaceda0b@mail.gmail.com... > > On 6/17/07, muquaddim <shiplu.net@gmail.com> wrote: > >> Hi, > >> I have use dumpbin to get the method names of php5ts.dll file. I get many > >> names. > >> 2 of these methods are, > >> "php_execute_script" > >> "php_execute_simple_script" > >> > >> I guess these are the methods that are responsible for executing php > >> source > >> (.php) files. > >> now I need to know, what are the parameter of these methods. How can I > >> get > >> the documenttation on parameters. > >> If I get this I could have make a .NET wrapper. > >> Thanks > > > > Just take a look at the PHP Source code, the functions are well > > described there... :) > > > > Tijnema > Yes I have been watching the source for long time. But no hope. There is no > comments on the source. > In the /main/main.c file I found this, > PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC) > here TSRMLS_DC is defined in /Zend/zend_language_scanner.c file as > ------------------------------------------------------------- > #ifdef ZTS > #define TSRMLS_D void ***tsrm_ls > #define TSRMLS_DC , TSRMLS_D > #define TSRMLS_C tsrm_ls > #define TSRMLS_CC , TSRMLS_C > #else > #define TSRMLS_D > #define TSRMLS_DC > #define TSRMLS_C > #define TSRMLS_CC > #endif > ------------------------------------------------------------- > this is contitional compilation. thats why I dont' know where the > php_execute_script method int php5ts.dll has the last parameter. > I think you understand. > The main problem with the last parameter
Well, that has something to do with Maintainer ZTS mode, I don't study on PHP source myself, but php_execute_script requires a file handle, so you should open one first. (With some zend function...) Like Johannes said, take a look at other SAPI's, as there's usefull information in too... Tijnema

Johannes Schlueter

19 years ago
Hi muquaddim, before calling these API functions you have to initialise some data structures. The usual way to embed PHP into another environment is to provide an SAPI module which wraps PHP's APIs to something you can use from another system in a nice way. See php-src/sapi/embed/ for a quite simple SAPI module, and Sara's book (ISBN-10: 067232704X, ISBN-13: 978-0672327049) as a reference. johannes On Sun, 2007-06-17 at 21:56 +0600, muquaddim wrote:

Wez Furlong

19 years ago
On 6/17/07, muquaddim <shiplu.net@gmail.com> wrote:
> If I get this I could have make a .NET wrapper.
You may also want to look at this: http://netevil.org/blog/2004/jul/phpscript source code: http://cvs.php.net/viewvc.cgi/pecl/activescript/ --Wez.

muquaddim

19 years ago
I think the configure option "--disable-zts" will work on the following lines. #ifdef ZTS #define TSRMLS_D void ***tsrm_ls #define TSRMLS_DC , TSRMLS_D #define TSRMLS_C tsrm_ls #define TSRMLS_CC , TSRMLS_C #else #define TSRMLS_D #define TSRMLS_DC #define TSRMLS_C #define TSRMLS_CC In that case my function definition will be easily understandable as I don't understand the TSRMLS_DC part. I am planning to call the php5nsapi.dll entry points. those were most easy for me. Just tell me someone, Is it the right way?

Johannes Schlueter

19 years ago
Hi again, On Mon, 2007-06-18 at 18:12 -0400, muquaddim wrote:
> I think the configure option "--disable-zts" will work on the following > lines. > > #ifdef ZTS > #define TSRMLS_D void ***tsrm_ls > #define TSRMLS_DC , TSRMLS_D > #define TSRMLS_C tsrm_ls > #define TSRMLS_CC , TSRMLS_C > #else > #define TSRMLS_D > #define TSRMLS_DC > #define TSRMLS_C > #define TSRMLS_CC > > In that case my function definition will be easily understandable as I don't > understand the TSRMLS_DC part.
Sara has a nice article about TSRM: http://blog.libssh2.org/index.php?/archives/22-What-the-heck-is-TSRMLS_CC-anyway.html and since you're using php5ts.dll you have zts enabled.
> I am planning to call the php5nsapi.dll entry points. those were most easy > for me. > Just tell me someone, Is it the right way?
When using php5nsapi.dll you're application has to offer the nsapi stuff PHP uses then. As said in my last post: The best is to build a custom SAPI which fit's your need. I mentioned sapi/embed, Wez had a few suggestions about activescript. Just calling some random API functions will most likely not work, you should first write a (small) sapi in C giving you the API you need for your needs. johannes

Richard Quadling

19 years ago
On 19/06/07, Johannes Schlüter <johannes@schlueters.de> wrote: > Sara has a nice article about TSRM: > http://blog.libssh2.org/index.php?/archives/22-What-the-heck-is-TSRMLS_CC-anyway.html and since you're using php5ts.dll you have zts enabled. Why have ... TSRMLS_CC when ... , TSRMLS_C actually looks more "correct" when you're reading the code ... php_myextension_globals_ctor(&myextension_globals TSRMLS_CC); vs php_myextension_globals_ctor(&myextension_globals , TSRMLS_C); I'm not saying change anything, but from someone trying to make headway with the source, it just looks right (parameters are separated by a comma not a space). -- ----- Richard Quadling Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 "Standing on the shoulders of some very clever giants!"

Stut

19 years ago
Richard Quadling wrote:
> On 19/06/07, Johannes Schlüter <johannes@schlueters.de> wrote: >> Sara has a nice article about TSRM: >> http://blog.libssh2.org/index.php?/archives/22-What-the-heck-is-TSRMLS_CC-anyway.html >> and since you're using php5ts.dll you have zts enabled. > > Why have ... > > TSRMLS_CC > > when ... > > , TSRMLS_C > > actually looks more "correct" when you're reading the code ... > > php_myextension_globals_ctor(&myextension_globals TSRMLS_CC); > > vs > > php_myextension_globals_ctor(&myextension_globals , TSRMLS_C); > > > I'm not saying change anything, but from someone trying to make > headway with the source, it just looks right (parameters are separated > by a comma not a space).
Because those macros may be defined as empty, meaning you'd be trying to compile... php_myextension_globals_ctor(&myextension_globals , ); ...which the compiler is not gonna like at all. -Stut
-- http://stut.net/

Gwynne Raskind

19 years ago
On Jun 19, 2007, at 4:38 AM, Richard Quadling wrote:
>> Sara has a nice article about TSRM: >> http://blog.libssh2.org/index.php?/archives/22-What-the-heck-is- >> TSRMLS_CC-anyway.html and since you're using php5ts.dll you have >> zts enabled. > Why have ... > > TSRMLS_CC > > when ... > > , TSRMLS_C > > actually looks more "correct" when you're reading the code ... > > php_myextension_globals_ctor(&myextension_globals TSRMLS_CC); > > vs > > php_myextension_globals_ctor(&myextension_globals , TSRMLS_C); > > > I'm not saying change anything, but from someone trying to make > headway with the source, it just looks right (parameters are separated > by a comma not a space).
Because with ZTS off, this would result in: php_myextension_globals_ctor(&myextension_globals, ); Which would be a syntax error. -- Gwynne, Daughter of the Code "This whole world is an asylum for the incurable."

Richard Lynch

19 years ago
On Tue, June 19, 2007 3:38 am, Richard Quadling wrote:
> On 19/06/07, Johannes Schlüter <johannes@schlueters.de> wrote: >> Sara has a nice article about TSRM: >> http://blog.libssh2.org/index.php?/archives/22-What-the-heck-is-TSRMLS_CC-anyway.html >> and since you're using php5ts.dll you have zts enabled. > > Why have ... > > TSRMLS_CC > > when ... > > , TSRMLS_C > > actually looks more "correct" when you're reading the code ... > > php_myextension_globals_ctor(&myextension_globals TSRMLS_CC); > > vs > > php_myextension_globals_ctor(&myextension_globals , TSRMLS_C); > > > I'm not saying change anything, but from someone trying to make > headway with the source, it just looks right (parameters are separated > by a comma not a space).
So, when would it ever be "right" to use the _C version? Someplace where the code is completely meaningless in a non-ZTS environment only?... That seems kind of an awful lot of meta-knowledge to have to carry around in one's head...
-- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?

Stanislav Malyshev

19 years ago
> So, when would it ever be "right" to use the _C version?
When you have function that its one (possible) argument is TRSM pointer.
-- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com

muquaddim

19 years ago
So I have to write my own Sapi module in PHP way :-( It looks like too tough for me. And its the right way. My intention is to implement a simple funcion int execute(char *filename); //filename is a php file For I have to write a sapi module. No matter I'll at least try it. Now the big question. Can anyone tell me how to write sapi modules for php I have googled for long time but no hope. I have seen that the directories and the sourc file in the sapi directory has a special format. May be this is the format of SAPI module. It would be great if there is any example. sapi/example perhaps. Lastly about Sara's book. I have to buy it. This is what I cant. Please show me way.