Easiest way to build / obtain php_memcache.dll for

2019-03-29 08:53发布

问题:

I'm planning to use Traits, available in PHP 5.4 on our application that requires Memcache and hence php_memcache.dll

I'm developing on a Windows machine using PHP 5.4 latest release candidate.

I am unable to source a PHP 5.4 build of php_memcache.dll so would like to know either how to obtain it or failing that, build it myself (the instructions on http://www.php.net/manual/en/install.windows.building.php seem a little lacking!).

I do not have Visual Studio or any build tools installed on my machine (and ideally do not want to pay for any).

Thanks

回答1:

This doc page explains how to do it: http://php.net/manual/en/install.pecl.windows.php

But the best way to easily achieve this would be to run ubuntu/fedora as a virtual os (using virtualbox). Getting newer versions of any extensions will be way easier under unix.

You could still develop on windows and use a shared directory to run the php code in the linux VM.



回答2:

It seems PECL/memcache 3.0.5 and 3.0.6 don't compile properly under Windows (at least not with the instructions provided in PHP's Wiki). Version 2.2.6 does appear to compile properly.

Follow the instructions in the Wiki and use this configure string:

--enable-cli-win32 --disable-zts --disable-isapi --disable-nsapi --without-mssql --without-pdo-mssql --without-pi3web --disable-static-analyze --enable-memcache=shared

That should give you a "php_memcache.dll" compatible with PHP 5.4.0 (VC9, non thread-safe). These options (with some small modifications) were taken from the build configuration of the Win32 binaries provided on PHP.net.

The extension loads without errors in PHP 5.4.0RC6, but I haven't actually (stress-)tested it in any meaningful way...