使用Visual Studio 2008在Windows上编译自己的PHP扩展 [英] Compiling my own PHP extension on Windows with Visual Studio 2008

查看:132
本文介绍了使用Visual Studio 2008在Windows上编译自己的PHP扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个PHP扩展,可以在Linux下成功编译和运行.但是在Windows上,我遇到了一些问题.

I wrote a PHP extension and it could be compiled and run under linux successfully. But on windows, I met some problems.

我根据 http://blog.slickedit.com/?p在Windows上进行了编译= 128 (PHP源版本为5.2.10),编译后生成了dll文件.但是,当我尝试使用dll文件时,它在启动Apache(Wamp服务器)时向我报告了内存问题.然后我开始调试过程,似乎REGISTER_INI_ENTRIES()出现问题.

I did the compiling on windows according to http://blog.slickedit.com/?p=128 with PHP source version 5.2.10, and after the compiling it generated the dll file. But when I tried to use the dll file, it reported me the memory problems when starting Apache(Wamp server). And then I started the debugging process, it seemed that REGISTER_INI_ENTRIES() had problems.

这是PHP扩展源代码, http://www.bluefly.cn/xsplit .tar.gz ,并且在Linux上运行良好.但我也想使其在Windows上运行.

Here is the PHP extension source code, http://www.bluefly.cn/xsplit.tar.gz , and it works fine on Linux. But I also want to make it work on Windows.

对不起,我不是专业人士,所以我希望有人可以帮助我.

Sorry I am not a pro so that I hope someone can help me.

感谢您的帮助,在此先感谢〜

Any help is appreciated and thanks in advance~

推荐答案

在Linux上未发现问题的原因很可能是您在Windows上进行了线程安全构建,而不是在Linux上.尝试在Linux上添加--enable-maintainer-zts,然后使用valgrind(USE_ZEND_ALLOC=0 valgrind /usr/bin/php script.php)

The reason you're not seeing an issue on Linux is most likely that you're doing a thread safebuild on windows, but not on Linux. Try adding --enable-maintainer-zts on Linux and then check using valgrind (USE_ZEND_ALLOC=0 valgrind /usr/bin/php script.php)

快速浏览一下代码,我发现您没有定义php_xsplit_init_globals用来初始化线程变量的代码.必须通过添加MINIT注册该功能

From a quick glanceover your code I saw that you didn't define your php_xsplit_init_globals which initialized thread variables. Tis function has to be registered from MINIT by adding a

ZEND_INIT_MODULE_GLOBALS(xsplit, php_yplist_init_globals, NULL);

打电话.也许其他地方有问题,但这是我所看到的第一件事.

call. Maybe something else is wrong, but that's the first thing I saw.

这篇关于使用Visual Studio 2008在Windows上编译自己的PHP扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆