I have purchased a book on Zend framework and had looked in to the hooks in C and what you can do with them, I have successfully created a PHP Zend extension (attached if you want to look) which will run under PHP embedded.. but it will not run as an extension.
How can I hook it into the PHP engine, especially the part to configure and add it as a shared object? The book hardly gets into any of that.
My addon: Private Paste - Pastie
2 replies to this topic
#1
Posted 06 January 2011 - 09:46 PM
|
|
|
#2
Posted 06 January 2011 - 11:09 PM
1) Place into /ext/ folder, testplugin.c as you are invoking that in your code.
It should be in the devel docs somewhere, but just create a config.m4
I am not sure if this will run, I have done this from memory, refer to the docs for dl() once enabled in per-dir settings
It should be in the devel docs somewhere, but just create a config.m4
PHP_ARG_ENABLE(testaddon, whether to enable Fighter's testaddon support, [ --enable-testaddon I am displayed within ./configure --help..]) if test "$PHP_TESTADDON" = "yes"; then AC_DEFINE(TESTADDON, 1, [Whether you have testaddon]) PHP_NEW_EXTENSION(testaddon, testaddon.c, $ext_shared) fiImportant: note the shared library name.
I am not sure if this will run, I have done this from memory, refer to the docs for dl() once enabled in per-dir settings
dl('testaddon.so');
__MAIN__(); you may want to create a platform wrapper,mind the constantshandle platforms
function _dl($n) {
return extension_loaded($n)
|| dl(
((PHP_SHLIB_SUFFIX === 'dll')
? 'php_'
: '')
. ($f ? $f : $n) . '.' . PHP_SHLIB_SUFFIX);
}
Hook library of course
__MAIN__();This is really jogging my memory, find the developer docs and we can both debug this together if need be. [noparse]:)[/noparse]
Edited by Alexander, 06 January 2011 - 11:40 PM.
updated config.m4
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
#3
Posted 12 January 2011 - 02:03 AM
I managed to set up its own php.ini section and simple installer in repositories, thank you for setting me on the right track Alex.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









