diff --git a/Makefile.in b/Makefile.in index 0ebb300..ff07b04 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,7 +1,7 @@ MODULE_NAME=@MODULE_NAME@ MODULE_OBJS=php_embeded.o GetPathDir.o $(MODULE_NAME).o CFLAGS=-fPIC -I@ZABBIX_INC_DIR@ @CFLAGS@ -Wno-cpp -LDFLAGS=@LDFLAGS@ +LDFLAGS=@LDFLAGS@ -Wl,--no-as-needed LIBS=@LIBS@ CC=gcc diff --git a/configure.ac b/configure.ac index 9c8986f..e7c9cb9 100644 --- a/configure.ac +++ b/configure.ac @@ -47,6 +47,6 @@ AC_CONFIG_HEADER(zbx_php_config.h) AC_OUTPUT(Makefile) echo "" -echo " Zabbix PHP laodable module install diretory = ${prefix}" -echo " Embeded PHP base directory = ${PHP_PREFIX}" -echo " Zabbix include directory = ${ZABBIX_INC_DIR}" +echo " Zabbix PHP laodable module install diretory[prefix] = ${prefix}" +echo " Embeded PHP base directory = ${PHP_PREFIX}" +echo " Zabbix include directory = ${ZABBIX_INC_DIR}" diff --git a/php_embeded.c b/php_embeded.c index 20b647b..b256f6f 100644 --- a/php_embeded.c +++ b/php_embeded.c @@ -123,7 +123,7 @@ int php_embed_execute(char *filename, zval *retval TSRMLS_DC) zfd.free_filename = 0; zfd.opened_path = NULL; zend_try { - if (SUCCESS == zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, &retval, 1, &zfd)) + if (SUCCESS == zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, retval, 1, &zfd)) return SUCCESS; } zend_end_try(); return FAILURE; diff --git a/zbx_php.c b/zbx_php.c index 2bd526a..2a6c198 100644 --- a/zbx_php.c +++ b/zbx_php.c @@ -156,6 +156,15 @@ int zbx_module_init() { TSRMLS_FETCH(); + void *handle; + char szPhpLib[256]; + snprintf(szPhpLib, sizeof szPhpLib, "%s%d%s", "libphp", PHP_MAJOR_VERSION, ".so"); + handle = dlopen (szPhpLib, RTLD_LAZY | RTLD_GLOBAL); + if (!handle) { + zabbix_log( LOG_LEVEL_ERR, ZBX_MODULE "load %s error!!!!\n%s",szPhpLib,dlerror()); + exit(1); + } + // load zbx_php.cfg config file if (load_php_env_config()!=ZBX_MODULE_OK) { diff --git a/zbx_php.h b/zbx_php.h index b49bf1d..c1c930e 100644 --- a/zbx_php.h +++ b/zbx_php.h @@ -26,6 +26,7 @@ #include #include #include +#include // this macro are defined in php and in zabbix // to avoid warning in redefiniting it they are undef her befor