我有
在windows上创建了一个非常简单的“Hello World”风格的PHP扩展dll,之后麻烦不可估量。然而,尽管我已经成功地创建了一个DLL,并将其放入extensions文件夹中,并将其告知php.in I,但现在我得到了:
PHP警告:PHP Startup:\x81\xc2\xc0\x03L&\xc0\x03:无法初始化用模块API=16777522编译的模块\nPHP用模块API=20090626编译的模块\n这些选项需要在第0行的“未知”中匹配
警告
:PHP启动:L&无法初始化模块
使用模块API=16777522编译的模块
这些选项需要匹配
未知
在线
似乎我的PHP_API_版本是20090626,但由于某种原因,我的DLL认为它的PHP_API_版本是16777522。
我自己写的,我有权访问所有的php扩展的源代码-但是,我在哪里控制最终出现在DLL中的php-API-u版本呢?
我用Borland C++ +Builder V5.5编译了DLL,而不是VisualStudio。
如果重要的话,这里是完整的来源:
// Needed to make following two #includes compatible with borland header files
void __fastcall __assume(int t) {
return;
}
typedef unsigned int socklen_t;
typedef enum BOOL
{
false=0,
true
} bool;
// end Borland compatibility code
#include "php.h"
#include "zend_config.w32.h"
ZEND_FUNCTION(fetch_LinkGrammar_links);
zend_function_entry LinkGrammar_ext_functions[] = {
ZEND_FE(fetch_LinkGrammar_links, NULL)
{NULL, NULL, NULL}
};
zend_module_entry LinkGrammar_ext_module_entry = {
STANDARD_MODULE_HEADER,
"LinkGrammar Extension",
LinkGrammar_ext_functions,
NULL, NULL, NULL, NULL, NULL,
"1.0",
STANDARD_MODULE_PROPERTIES
};
ZEND_GET_MODULE(LinkGrammar_ext);
ZEND_FUNCTION(fetch_LinkGrammar_links)
{
bool World = false;
char *RetVal= "";
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &World) == FAILURE)
{
RETURN_STRING("Missing Parameter", true);
}
if (World == true)
{
RetVal= "Hello World";
}
else
{
RetVal= "Hello";
}
RETURN_STRING(RetVal, true);
}