简体   繁体   中英

Compiling a php extension into a dll

I've been attempting for a last few days to make use of the operator overloading extension (pecl.php.net/package/operator), which has apparently been updated recently to be compatible with 5.3 and 5.4.

I've tried compiling it in windows (64-bit Windows 7) using this guide , with PHP 5.4 and Windows SDK 7.1 without luck. So I tried doing it with PHP 5.3 and Windows SDK 6.1 and I can get it to successfully compile with the config "configure --disable-all --enable-cli --enable-operator" and then "nmake". The problem is that it doesn't produce a dll file for the operator extension, instead what I get is this , which is apparently useless for me. What I want is a dll I can use for my local WampServer setup.

I had had fatal errors when trying to use operator-0.4.1 from the pecl.php.net site, so instead I downloaded and compiled from the git repository (github.com/php/pecl-php-operator), which is what produced the .obj, .idb and .sbr files.

You have to do

configure --disable-all --enable-cli --enable-operator=shared

otherwise it's statically compiled.

Anyway, if you want to use it with WampServer, the binary will probably not work because if I'm not mistaken WampServer is compiled against the VC10 C runtime library, while the guide you linked to instructs you to use Visual Studio 2008 (which comes with VC9). You'll need to use the VC10 compiler (I think it's bundled with Windows SDK 7.1, so you can download just that and skip Visual Studio).

Into extension root path, and modify config.w32

EXTENSION('redis', sources); to EXTENSION('redis', sources,true);

buildconf --force

configure --enable-xx 

nmake

you'll get php-redis.dll

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM