碰到了不少问题 ,但最终都解决了,感受不错。php
1)下载 php source, php sdk, 以及 win32ps的源代码windows
2) 参照下面的链接进行编译。php7
https://wiki.php.net/internals/windows/stepbystepbuildui
注意点:spa
a) 设置phpsdk_setvars.bat环境变量以前,设置vc 的环境变量。 .net
"D:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x64
b) 文章介绍的目录结构太深了,我这样的结构也是没有问题的。code
SDK:D:\tool\php-sdkblog
php source: D:\proj\php-srcget
win32ps: D:\proj\pecl\win32ps-1.0.1it
c) 加上 "=shared" 就能够编译 extension dll 了(要不就会直接静态链接到php)
configure --disable-all --enable-cli --enable-win32ps=shared
3) 源代码的修改。
a) MAKE_STD_ZVAL 被php7 废除了。 因此,改为相似下面的语句
// MAKE_STD_ZVAL(tms); zval tms_instance; tms = &tms_instance;
b) 运行时,加载extension 会出现 【PHP Startup: Invalid library maybe not a PHP library 】错误
在win32ps.c 加上下面的代码,从新编译
#ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef COMPILE_DL_WIN32PS ZEND_GET_MODULE(win32ps) #endif
以上。