|
Posted by Patric Stout on 03/16/05 21:43
Currently I am trying to get embed PHP to work. A nice C-application
that can handle PHP-scripts. I hope this is the right place to ask
question about it...
First of all, there is very poor documentation about this subject on the
web. Even the Zend-docs are outdated. This doesn't make it easier. But
anyway, I have a real problem, which I can't fix... I hope one of you
know what to do about it:
most of the code works, it loads a script, runs it, and it stops when I
want it to. Now I want to register functions on the fly. This is the
part where it goes wrong.
I run a:
zend_register_functions(NULL, add_func_array, CG(function_table),
MODULE_PERSISTENT);
two times, some cycles after the zend_execute_file is called (more
exact: it is done on user-request), every time with an other
function-name. Now I can call both functions from PHP, that works. But
now when I close my application, it crashes. Glibc gives me an error
that a pointer is tried to free'd twice. Here the GDB output:
#0 0x0000002a95e009b9 in raise () from /lib/tls/libc.so.6
#1 0x0000002a95e01fff in abort () from /lib/tls/libc.so.6
#2 0x0000002a95e3be7b in mallopt () from /lib/tls/libc.so.6
#3 0x0000002a95e39a22 in free () from /lib/tls/libc.so.6
#4 0x0000002a9760d1c0 in _efree () from /usr/lib/libphp5.so
#5 0x0000002a97619e36 in destroy_op_array () from /usr/lib/libphp5.so
#6 0x0000002a97619beb in destroy_zend_function () from /usr/lib/libphp5.so
#7 0x0000002a97619bf9 in zend_function_dtor () from /usr/lib/libphp5.so
#8 0x0000002a97627c2f in zend_hash_destroy () from /usr/lib/libphp5.so
#9 0x0000002a97620be3 in zend_shutdown () from /usr/lib/libphp5.s
I tried almost everything, and I am running out of ideas.. is this a
bug, or is it not allowed to add functions on the fly to the same
hash-table, or...
Of course I tried many many scenarios to isolate the problem. It works
all pretty and nice, as long as I register all the functions BEFORE
running zend_execute_file. I want to add functions after that time.
Nowhere in the source I can see such restriction, and I see no reason
why it should not work.. I hope you guys can help me.
Oh, one more note: I am running 64-bit linux, maybe that has something
to do with it..
Tnx for your time,
Patric Stout
Navigation:
[Reply to this message]
|