PHP嵌入共享库没有加载任何扩展

时间:2015-09-13 09:48:04

标签: php c

我和https://serverfault.com/questions/702661/php5-embed-does-not-load-extensions?rq=1有类似的问题。不确定他是否正在使用embed编写共享库。但我的问题是“运行”我构建的共享库。作为可执行文件加载扩展。但不是作为共享库(.so)。我的所有扩展都失败了所有这些都在指定的位置。

Failed loading /usr/lib/php5/20121212/opcache.so:  /usr/lib/php5/20121212/opcache.so: undefined symbol: zend_ini_boolean_displayer_cb
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212/oci8.so' - /usr/lib/php5/20121212/oci8.so: undefined symbol: OnUpdateLong in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212/pdo.so' - /usr/lib/php5/20121212/pdo.so: undefined symbol: compiler_globals in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212/pdo_oci.so' - /usr/lib/php5/20121212/pdo_oci.so: undefined symbol: php_info_print_table_start in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212/pdo.so' - /usr/lib/php5/20121212/pdo.so: undefined symbol: compiler_globals in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212/pdo_oci.so' - /usr/lib/php5/20121212/pdo_oci.so: undefined symbol: php_info_print_table_start in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212/oci8.so' - /usr/lib/php5/20121212/oci8.so: undefined symbol: OnUpdateLong in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212/curl.so' - /usr/lib/php5/20121212/curl.so: undefined symbol: zend_new_interned_string in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212/json.so' - /usr/lib/php5/20121212/json.so: undefined symbol: zend_new_interned_string in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212/readline.so' - /usr/lib/php5/20121212/readline.so: undefined symbol: OnUpdateString in Unknown on line 0

通过“未定义符号”的声音警告它显然缺少与环境相关的东西。 Zend库或未加载的东西来处理加载扩展。

下面的代码正是我在.so文件中使用的代码,除了显然是重命名的。我猜某个地方,因为.so,环境设置需要发生:

#include <stdio.h>
#include <stdlib.h>
#include "/usr/include/php/sapi/embed/php_embed.h"

int main( int argc, char *argv[] )
{       
    char *filename = "/path/to/php/test.php";
    argc--;
    argv++;

    PHP_EMBED_START_BLOCK(argc,argv)

        zval zoutput;
        char *include_file;     

        spprintf( &include_file, 0, "include '%s';", filename  );
        zend_eval_string( include_file, &zoutput, filename TSRMLS_CC );
        efree(include_file);

    PHP_EMBED_END_BLOCK()

    return 0;

}

任何帮助将不胜感激。感谢。

0 个答案:

没有答案