I have enabled debugging and such.. Here is a spit out of bt from gdb
#0 0x00501144 in ?? ()
#1 0x010f6578 in tsrm_shutdown () at
/usr/src/docelmo/trunk/libs/php-5.1.6/TSRM/TSRM.c:180
#2 0x011c8759 in php_embed_shutdown (tsrm_ls=0x899e9d8) at
/usr/src/docelmo/trunk/libs/php-5.1.6/sapi/embed/php_embed.c:216
#3 0x002ec88f in php_function (session=0x89ac1d8, data=0x89a69f8
"/usr/local/freeswitch/scripts/apptest.php") at mod_php.c:244
#4 0x00182cdf in switch_core_session_run (session=0x89ac1d8) at
src/switch_core.c:2192
#5 0x001836f2 in switch_core_session_thread (thread=0x501144, obj=0x6c)
at src/switch_core.c:2751
#6 0x00131a38 in dummy_worker () from
/usr/local/freeswitch/lib/libapr-1.so.0
#7 0x4e05c371 in start_thread () from /lib/tls/libpthread.so.0
#8 0x4dfb59be in clone () from /lib/tls/libc.so.6
Here is bt full from gdb
#0 0x00501144 in ?? ()
No symbol table info available.
#1 0x010f6578 in tsrm_shutdown () at
/usr/src/docelmo/trunk/libs/php-5.1.6/TSRM/TSRM.c:180
j = 27
p = (tsrm_tls_entry *) 0x899e9d8
next_p = (tsrm_tls_entry *) 0x0
i = 0
#2 0x011c8759 in php_embed_shutdown (tsrm_ls=0x899e9d8) at
/usr/src/docelmo/trunk/libs/php-5.1.6/sapi/embed/php_embed.c:216
No locals.
#3 0x002ec88f in php_function (session=0x89ac1d8, data=0x89a69f8
"/usr/local/freeswitch/scripts/apptest.php") at mod_php.c:244
uuid = 0x89ae550 "143fcad9-99b8-4a33-a6ad-8ebda490fee1"
ulen = 36
len = 79
mydata = 0x89a6a38 "143fcad9-99b8-4a33-a6ad-8ebda490fee1"
argc = 2
retval = 1
argv = {0x89a6a38 "143fcad9-99b8-4a33-a6ad-8ebda490fee1",
0x89a6a5d "/usr/local/freeswitch/scripts/apptest.php", 0x0, 0x0, 0x0}
php_code = "/usr/local/freeswitch/scripts/apptest.php
143fcad9-99b8-4a33-a6ad-8ebda490fee1\000ipts/apptest.php\");\n\000\001",
'\0' <repeats 23 times>,
"ó\004\000\000\000\000\000\000\000\020\000\000\020\000\000\000\000\000\000\000ò$\006E\002\000\000\000\002\000\000\000\000\000\000\000º\026õD\000\000\000\0000\200n\000\000\000\000\000,
\213¶± õM X\001N\017\000\000\000ô?\001N\017\000\000\000\237\223\000NL
\213¶ælõM¨"...
tsrm_ls = (void ***) 0x899e9d8
script = {type = 2 '\002', filename = 0x89a69f8
"/usr/local/freeswitch/scripts/apptest.php",
opened_path = 0x8ac7218 'Z' <repeats 42 times>, "\204Ì\217*", handle =
{fd = 144304216, fp = 0x899e858, stream = {handle = 0x899e858,
reader = 0x116c66c <zend_stream_stdio_reader>, closer = 0x116c697
<zend_stream_stdio_closer>, fteller = 0x116c6ca <zend_stream_stdio_fteller>,
interactive = 0}}, free_filename = 0 '\0'}
__FUNCTION__ = "php_function"
php_uuid = (zval *) 0x8ac6d90
#4 0x00182cdf in switch_core_session_run (session=0x89ac1d8) at
src/switch_core.c:2192
index = Variable "index" is not available.
All apptest.php does is echo hello world!..
Here is the code for php_function
static void php_function(switch_core_session_t *session, char *data)
{
char *uuid = switch_core_session_get_uuid(session);
uint32_t ulen = strlen(uuid);
uint32_t len = strlen((char *) data) + ulen + 2;
char *mydata = switch_core_session_alloc(session, len);
int argc, retval;
char *argv[5];
char php_code[1024];
void*** tsrm_ls = NULL;
snprintf(mydata, len, "%s %s", uuid, data);
argc = switch_separate_string(mydata, ' ',argv,(sizeof(argv) /
sizeof(argv[0])));
sprintf(php_code, "uuid=\"%s\"; include(\"%s\");\n", argv[0],
argv[1]);
//sprintf(php_code, "include('%s');", argv[1]);
sprintf(php_code, "%s %s", data, uuid);
zend_file_handle script;
script.type = ZEND_HANDLE_FP;
script.filename = data;
script.opened_path = NULL;
script.free_filename = 0;
script.handle.fp = fopen(script.filename, "rb");
// Initialize PHPs CORE
php_embed_init(argc, argv, &tsrm_ls);
// Return All of the DEBUG crap to the console and/or a log file
php_embed_module.ub_write = sapi_mod_php_ub_write;
php_embed_module.log_message = mod_php_log_message;
php_embed_module.sapi_error =
(sapi_error_function_t)mod_php_error_handler;
// Let the nice people know we are about to start their script
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,
"Starting Script %s\n",data);
// Force $uuid and $session to exist in PHPs memory space
zval *php_uuid;
MAKE_STD_ZVAL(php_uuid);
//MAKE_STD_ZVAL(php_session);
//php_uuid->type = IS_STRING;
//php_uuid->value.str.len = strlen(uuid);
//php_uuid->value.str.val = estrdup(uuid);
ZVAL_STRING(php_uuid, uuid , 1);
//ZVAL_STRING(php_session, session , 1);
ZEND_SET_SYMBOL(&EG(symbol_table), "uuid", php_uuid);
//ZEND_SET_SYMBOL(&EG(active_symbol_table), "session", php_session);
// Force Some INI entries weather the user likes it or not
//zend_alter_ini_entry("register_globals",
strlen("register_globals")+1, "1", 1, PHP_INI_SYSTEM,
PHP_INI_STAGE_RUNTIME);
// Execute the bloody script
retval = php_execute_script(&script TSRMLS_CC);
// Clean up after PHP and such
php_embed_shutdown(tsrm_ls);
// Return back to the Dialplan
// Buh bye now!
}
The code is fairly hacked up but I plan to clean it up once its 100%
stable. The errors in the code doesnt really tell me anything. I
execute the php script and it core dumps on completion. Can anyone give
me a clue on whats going on?
brian
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php